| @@ -121,10 +121,17 @@ | ||
| 121 | 121 | */ |
| 122 | 122 | public function clear_all(): bool { |
| 123 | 123 | global $wpdb; |
| 124 | 124 | |
| 125 | - // Clear memory cache (if using object cache) | |
| 126 | - wp_cache_flush_group(self::CACHE_GROUP); | |
| 125 | + // Clear memory cache (if using object cache). | |
| 126 | + // wp_cache_flush_group() is WP 6.1+ and the plugin supports 6.0; see | |
| 127 | + // Schema_Cache_Manager::clear_all() for the reasoning behind the | |
| 128 | + // fallback rather than a skip. | |
| 129 | + if (function_exists('wp_cache_flush_group')) { | |
| 130 | + wp_cache_flush_group(self::CACHE_GROUP); | |
| 131 | + } else { | |
| 132 | + wp_cache_flush(); | |
| 133 | + } | |
| 127 | 134 | |
| 128 | 135 | // Clear database cache |
| 129 | 136 | $table_name = $wpdb->prefix . 'thinkrank_ai_cache'; |
| 130 | 137 | // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Table name is properly constructed from controlled prefix, cache clearing requires direct database access |