PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.9.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.9.0
2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 1.0.1 1.0.2 All 50 releases
← All changes | includes/seo/class-schema-cache-manager.php +16 -4 1.28.0 → 2.9.0 View file →
@@ -136,10 +136,22 @@
136 136 */
137 137 public function clear_all(): bool {
138 138 global $wpdb;
139 139
140 - // Clear memory cache (if using object cache)
141 - wp_cache_flush_group(self::CACHE_GROUP);
140 + // Clear memory cache (if using object cache).
141 + //
142 + // wp_cache_flush_group() is WordPress 6.1+, and the plugin header
143 + // declares "Requires at least: 6.0" — on 6.0 this was a fatal
144 + // "call to undefined function" on every schema settings save, since
145 + // save_settings() reaches here via invalidate_all_cache(). Fall back to
146 + // a full flush rather than skipping: a no-op would leave stale schema
147 + // served until the database rows expire, which is worse than a coarse
148 + // flush. Deactivator already guards the same call this way.
149 + if (function_exists('wp_cache_flush_group')) {
150 + wp_cache_flush_group(self::CACHE_GROUP);
151 + } else {
152 + wp_cache_flush();
153 + }
142 154
143 155 // Clear database cache
144 156 $table_name = $wpdb->prefix . 'thinkrank_ai_cache';
145 157 // 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
@@ -207,9 +219,9 @@
207 219 public function generate_schema_generation_key(string $schema_type, array $data, array $options = []): string {
208 220 $key_data = [
209 221 'operation' => 'schema_generation',
210 222 'schema_type' => $schema_type,
211 - 'data_hash' => md5(serialize($data)),
223 + 'data_hash' => md5(wp_json_encode($data)),
212 224 'options' => $options,
213 225 'version' => THINKRANK_VERSION,
214 226 ];
215 227
@@ -229,9 +241,9 @@
229 241 public function generate_validation_key(array $schema_data, string $schema_type, array $options = []): string {
230 242 $key_data = [
231 243 'operation' => 'schema_validation',
232 244 'schema_type' => $schema_type,
233 - 'schema_hash' => md5(serialize($schema_data)),
245 + 'schema_hash' => md5(wp_json_encode($schema_data)),
234 246 'options' => $options,
235 247 'version' => THINKRANK_VERSION,
236 248 ];
237 249