PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.14.2
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.14.2
2.14.3 2.14.2 2.14.1 2.14.0 2.13.0 2.12.0 2.11.0 2.10.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 All 58 releases
← All changes | includes/admin/importers/class-squirrly-exporter.php +69 -10 2.12.0 → 2.14.2 View file →
@@ -192,10 +192,10 @@
192 192 'object_id' => $post_id,
193 193 'object_type' => 'post',
194 194 'source_plugin' => $this->plugin_slug,
195 195 'data' => [
196 - 'seo_title' => $this->convert_template_variables($this->seo_string($seo, 'title'), $post_id),
197 - 'meta_description' => $this->convert_template_variables($description, $post_id),
196 + 'seo_title' => $this->convert_post_value($this->seo_string($seo, 'title'), $post_id),
197 + 'meta_description' => $this->convert_post_value($description, $post_id),
198 198 'focus_keyword' => $focus_keywords[0] ?? '',
199 199 'focus_keywords' => $focus_keywords,
200 200 'canonical_url' => $this->seo_string($seo, 'canonical'),
201 201 'noindex' => $this->seo_flag($seo, 'noindex'),
@@ -202,13 +202,13 @@
202 202 'nofollow' => $this->seo_flag($seo, 'nofollow'),
203 203 'noarchive' => $robots['noarchive'],
204 204 'noimageindex' => $robots['noimageindex'],
205 205 'nosnippet' => $robots['nosnippet'],
206 - 'og_title' => $this->convert_template_variables($this->seo_string($seo, 'og_title'), $post_id),
207 - 'og_description' => $this->convert_template_variables($this->seo_string($seo, 'og_description'), $post_id),
206 + 'og_title' => $this->convert_post_value($this->seo_string($seo, 'og_title'), $post_id),
207 + 'og_description' => $this->convert_post_value($this->seo_string($seo, 'og_description'), $post_id),
208 208 'og_image' => $this->seo_string($seo, 'og_media'),
209 - 'twitter_title' => $this->convert_template_variables($this->seo_string($seo, 'tw_title'), $post_id),
210 - 'twitter_description' => $this->convert_template_variables($this->seo_string($seo, 'tw_description'), $post_id),
209 + 'twitter_title' => $this->convert_post_value($this->seo_string($seo, 'tw_title'), $post_id),
210 + 'twitter_description' => $this->convert_post_value($this->seo_string($seo, 'tw_description'), $post_id),
211 211 'twitter_image' => $this->seo_string($seo, 'tw_media'),
212 212 'primary_category' => (int) ($seo['primary_category'] ?? 0),
213 213 'schema_type' => $this->map_schema_type($seo['jsonld_types'] ?? null),
214 214 // Squirrly's `focuspage` marks a page as one of the site's
@@ -257,15 +257,15 @@
257 257 'object_id' => $parsed['object_id'],
258 258 'object_type' => 'term',
259 259 'source_plugin' => $this->plugin_slug,
260 260 'data' => [
261 - 'seo_title' => $this->convert_term_template($this->seo_string($seo, 'title'), $term),
262 - 'meta_description' => $this->convert_term_template($this->seo_string($seo, 'description'), $term),
261 + 'seo_title' => $this->convert_term_value($this->seo_string($seo, 'title'), $term),
262 + 'meta_description' => $this->convert_term_value($this->seo_string($seo, 'description'), $term),
263 263 'canonical_url' => $this->seo_string($seo, 'canonical'),
264 264 'noindex' => $this->seo_flag($seo, 'noindex'),
265 265 'nofollow' => $this->seo_flag($seo, 'nofollow'),
266 - 'og_title' => $this->convert_term_template($this->seo_string($seo, 'og_title'), $term),
267 - 'og_description' => $this->convert_term_template($this->seo_string($seo, 'og_description'), $term),
266 + 'og_title' => $this->convert_term_value($this->seo_string($seo, 'og_title'), $term),
267 + 'og_description' => $this->convert_term_value($this->seo_string($seo, 'og_description'), $term),
268 268 ],
269 269 'extended' => [
270 270 'taxonomy' => $parsed['taxonomy'],
271 271 'og_image' => $this->seo_string($seo, 'og_media'),
@@ -640,8 +640,67 @@
640 640
641 641 $value = (string) preg_replace('/\s{2,}/', ' ', $value);
642 642
643 643 return trim($value);
644 + }
645 +
646 + /**
647 + * Squirrly per-post variables ThinkRank resolves per request (#886): kept
648 + * as tags rather than frozen into text. Mirrors convert_global_pattern().
649 + */
650 + private const POST_TOKENS = [
651 + 'title' => '%title%',
652 + 'sitename' => '%sitename%',
653 + 'sep' => '%sep%',
654 + 'excerpt' => '%excerpt%',
655 + 'date' => '%date%',
656 + 'name' => '%author%',
657 + 'category' => '%category%',
658 + ];
659 +
660 + /**
661 + * Squirrly per-term variables ThinkRank resolves on a term archive —
662 + * the ones convert_term_template() seeds with the term's own values.
663 + */
664 + private const TERM_TOKENS = [
665 + 'term_title' => '%term%',
666 + 'title' => '%term%',
667 + 'category' => '%term%',
668 + 'tag' => '%term%',
669 + 'category_description' => '%excerpt%',
670 + 'excerpt' => '%excerpt%',
671 + 'sitename' => '%sitename%',
672 + 'sep' => '%sep%',
673 + ];
674 +
675 + /**
676 + * A per-post Squirrly value: mapped variables as ThinkRank tags, the rest literal.
677 + *
678 + * @param string $value Raw Squirrly value
679 + * @param int $post_id Post ID
680 + * @return string
681 + */
682 + private function convert_post_value(string $value, int $post_id): string {
683 + return $this->tokenize_object_template(
684 + $value,
685 + self::brace_token_patterns(self::POST_TOKENS),
686 + fn(string $rest): string => $this->convert_template_variables($rest, $post_id)
687 + );
688 + }
689 +
690 + /**
691 + * A per-term Squirrly value: mapped variables as ThinkRank tags, the rest literal.
692 + *
693 + * @param string $value Raw Squirrly value
694 + * @param \WP_Term|null $term The term, when it still exists
695 + * @return string
696 + */
697 + private function convert_term_value(string $value, ?\WP_Term $term): string {
698 + return $this->tokenize_object_template(
699 + $value,
700 + self::brace_token_patterns(self::TERM_TOKENS),
701 + fn(string $rest): string => $this->convert_term_template($rest, $term)
702 + );
644 703 }
645 704
646 705 /**
647 706 * Resolve a term-level value: the generic converter only knows post