PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.8.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.8.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 1.1.0 All 49 releases
← All changes | includes/frontend/class-seo-manager.php +231 -27 2.6.02.8.0 View file →
@@ -691,9 +691,86 @@
691 691 *
692 692 * @param string $title Resolved title.
693 693 * @return string Title with the page indicator, when there is one.
694 694 */
695 + /**
696 + * The archive's subject, without the label WordPress prefixes it with.
697 + *
698 + * `get_the_archive_title()` returns "Month: September 2026", "Archives:
699 + * Recipes", "Category: Uncategorized" — the label is core's, aimed at an
700 + * archive heading on the page, and it reads badly in a browser tab, an
701 + * og:title or a search result. Category, tag and author contexts already
702 + * avoid it by using the raw name; the generic archive context did not, so
703 + * date, custom-post-type and custom-taxonomy archives carried it (#640).
704 + *
705 + * Removed through core's own `get_the_archive_title_prefix` filter rather
706 + * than by matching the prefix text, because that text is translated and
707 + * differs per archive type — a string comparison would work in English and
708 + * silently stop working everywhere else.
709 + *
710 + * A site that wants a prefix can put one in its title template, where it is
711 + * visible and editable, instead of inheriting one it cannot see.
712 + *
713 + * @since 2.7.0
714 + *
715 + * @return string Archive subject, with markup and the core prefix removed.
716 + */
717 + private static function archive_subject(): string {
718 + $drop_prefix = static function (): string {
719 + return '';
720 + };
721 +
722 + add_filter('get_the_archive_title_prefix', $drop_prefix, 99);
723 +
724 + $title = (string) get_the_archive_title();
725 +
726 + remove_filter('get_the_archive_title_prefix', $drop_prefix, 99);
727 +
728 + // The <span> core wraps the subject in survives the prefix filter.
729 + return trim(wp_strip_all_tags($title));
730 + }
731 +
732 + /**
733 + * Remove HTML from a title that is about to be emitted.
734 + *
735 + * A title carrying markup is broken twice over, in two different ways, and
736 + * both were reaching real pages: inside `<title>` the tags render literally,
737 + * because that element is RCDATA and never parses them; inside `og:title`
738 + * and `twitter:title` they are attribute-escaped, so the reader sees
739 + * `&lt;em&gt;` as visible text (#640).
740 + *
741 + * Applied at the point of emission rather than at each source, so it covers
742 + * every branch that can produce a title — post meta, Global SEO templates,
743 + * Site Identity templates — without each having to remember.
744 + *
745 + * Unconditional rather than a setting: there is no title for which markup is
746 + * the correct output. The filter is the escape hatch for anyone who
747 + * disagrees, and lets a site keep entities it deliberately encoded.
748 + *
749 + * @since 2.7.0
750 + *
751 + * @param string $title Title about to be emitted.
752 + * @return string Title with any markup removed.
753 + */
754 + public static function strip_title_tags(string $title): string {
755 + /**
756 + * Filter whether HTML is stripped from generated titles.
757 + *
758 + * @since 2.7.0
759 + *
760 + * @param bool $strip Whether to strip. Default true.
761 + * @param string $title The title being emitted.
762 + */
763 + if (!apply_filters('thinkrank_strip_title_tags', true, $title)) {
764 + return $title;
765 + }
766 +
767 + return trim(wp_strip_all_tags($title));
768 + }
769 +
695 770 public static function with_page_suffix(string $title): string {
771 + $title = self::strip_title_tags($title);
772 +
696 773 $page = self::current_page_number();
697 774
698 775 if ($page <= 1 || '' === $title) {
699 776 return $title;
@@ -784,11 +861,13 @@
784 861 // Output main ThinkRank SEO header comment (only once)
785 862 self::note_opening_comment();
786 863
787 864 // Ensure description is within optimal length (150-160 characters)
788 - if (strlen($description) > 160) {
789 - $description = wp_trim_words($description, 25, '...');
790 - }
865 + // Measure and cut in CHARACTERS. strlen() counts bytes, so a Thai or
866 + // CJK description tripped this limit at a third of its length, and
867 + // wp_trim_words() then cut by a unit the locale chooses — 25 words in
868 + // English, 25 characters in Thai (#687).
869 + $description = \ThinkRank\Core\Seo_Text::trim_to_length($description);
791 870
792 871 echo "<!-- ThinkRank SEO Meta Description -->\n";
793 872 echo '<meta name="description" content="' . esc_attr($description) . '" />' . "\n";
794 873 echo "<!-- /ThinkRank SEO Meta Description -->\n";
@@ -1300,9 +1379,9 @@
1300 1379 *
1301 1380 * @param array $og_tags Open Graph tags array
1302 1381 * @return void
1303 1382 */
1304 - private function output_social_og_tags(array $og_tags): void {
1383 + private function output_social_og_tags(array $og_tags, array $extra_images = []): void {
1305 1384 // Honor the thinkrank_og_type filter here too — this "Enhanced" path is
1306 1385 // the active OG emitter, so add-ons (e.g. Pro's WooCommerce module which
1307 1386 // sets 'product' on product pages) must be applied to it, not only to
1308 1387 // output_open_graph_tags().
@@ -1346,12 +1425,62 @@
1346 1425 echo '<meta property="' . esc_attr($property) . '" content="' . $this->esc_meta_value($property, $content) . '" />' . "\n";
1347 1426 }
1348 1427 }
1349 1428
1429 + // Alternatives, after the primary and everything belonging to it.
1430 + // Order is the whole point: a consumer reads og:image tags in document
1431 + // order and treats the first as primary, and a structured property
1432 + // attaches to the most recently declared image — so each alternative's
1433 + // companions have to follow its own URL, not be grouped at the end.
1434 + self::output_extra_og_images($extra_images);
1435 +
1350 1436 echo "<!-- /ThinkRank SEO Open Graph Tags -->\n";
1351 1437 }
1352 1438
1353 1439 /**
1440 + * Emit the secondary og:image tags a page offers.
1441 + *
1442 + * Shared by the enhanced and basic emitters so both describe an
1443 + * alternative image the same way (#636).
1444 + *
1445 + * @since 2.7.0
1446 + *
1447 + * @param array $images Each with url, and width/height/type/alt where known.
1448 + * @return void
1449 + */
1450 + private static function output_extra_og_images(array $images): void {
1451 + foreach ($images as $image) {
1452 + $url = isset($image['url']) ? (string) $image['url'] : '';
1453 +
1454 + if ('' === $url) {
1455 + continue;
1456 + }
1457 +
1458 + echo '<meta property="og:image" content="' . esc_url($url) . '" />' . "\n";
1459 +
1460 + if (strpos($url, 'https://') === 0) {
1461 + echo '<meta property="og:image:secure_url" content="' . esc_url($url) . '" />' . "\n";
1462 + }
1463 +
1464 + // Only what is actually known: a dimension guessed for a remote
1465 + // image is a number a consumer lays a card out with before it has
1466 + // fetched the file.
1467 + if (!empty($image['width']) && !empty($image['height'])) {
1468 + echo '<meta property="og:image:width" content="' . esc_attr((string) $image['width']) . '" />' . "\n";
1469 + echo '<meta property="og:image:height" content="' . esc_attr((string) $image['height']) . '" />' . "\n";
1470 + }
1471 +
1472 + if (!empty($image['type'])) {
1473 + echo '<meta property="og:image:type" content="' . esc_attr((string) $image['type']) . '" />' . "\n";
1474 + }
1475 +
1476 + if (!empty($image['alt'])) {
1477 + echo '<meta property="og:image:alt" content="' . esc_attr((string) $image['alt']) . '" />' . "\n";
1478 + }
1479 + }
1480 + }
1481 +
1482 + /**
1354 1483 * Output social media Twitter Card tags from Social Meta Manager
1355 1484 *
1356 1485 * @param array $twitter_tags Twitter Card tags array
1357 1486 * @return void
@@ -1514,9 +1643,12 @@
1514 1643 // The Social Meta Manager ran, so it owns Open Graph output. If OG is
1515 1644 // toggled off, emit nothing — do NOT fall through to the basic
1516 1645 // emitter (which would re-add a full OG block despite the toggle).
1517 1646 if (!empty($social_data['og_enabled'])) {
1518 - $this->output_social_og_tags($social_data['og_tags']);
1647 + $this->output_social_og_tags(
1648 + $social_data['og_tags'],
1649 + $social_data['og_extra_images'] ?? []
1650 + );
1519 1651 }
1520 1652 return;
1521 1653 }
1522 1654
@@ -1584,9 +1716,9 @@
1584 1716 // "There is no excerpt because this is a protected post." placeholder,
1585 1717 // so this is not a leak — but publishing that sentence as the social
1586 1718 // description is worse than publishing none (#363).
1587 1719 if (!$description && !$this->is_content_password_protected()) {
1588 - $description = is_singular() ? wp_trim_words(get_the_excerpt(), 30) : get_bloginfo('description');
1720 + $description = is_singular() ? \ThinkRank\Core\Seo_Text::trim_words(get_the_excerpt(), 30) : get_bloginfo('description');
1589 1721 }
1590 1722
1591 1723 $url = is_singular() ? get_permalink() : home_url();
1592 1724 $site_name = $this->site_identity_data && !empty($this->site_identity_data['identity']['site_name'])
@@ -1614,11 +1746,11 @@
1614 1746 $og_type = apply_filters('thinkrank_og_type', $og_type);
1615 1747
1616 1748 echo "<!-- ThinkRank SEO Open Graph Meta Tags -->\n";
1617 1749 echo "<meta property=\"og:type\" content=\"" . esc_attr($og_type) . "\" />\n";
1618 - echo "<meta property=\"og:title\" content=\"" . esc_attr($title) . "\" />\n";
1750 + echo "<meta property=\"og:title\" content=\"" . esc_attr(self::strip_title_tags($title)) . "\" />\n";
1619 1751 echo "<meta property=\"og:description\" content=\"" . esc_attr($description) . "\" />\n";
1620 - echo "<meta property=\"og:url\" content=\"" . esc_url($url) . "\" />\n";
1752 + echo "<meta property=\"og:url\" content=\"" . esc_url(\ThinkRank\SEO\Url_Scheme::apply($url)) . "\" />\n";
1621 1753 echo "<meta property=\"og:site_name\" content=\"" . esc_attr($site_name) . "\" />\n";
1622 1754 /**
1623 1755 * Filter the og:locale value.
1624 1756 *
@@ -1635,14 +1767,17 @@
1635 1767 $og_locale = (string) apply_filters('thinkrank_og_locale', get_locale());
1636 1768 echo "<meta property=\"og:locale\" content=\"" . esc_attr($og_locale) . "\" />\n";
1637 1769
1638 1770 // Add OG image — per-post override > featured image
1771 + $primary_og_image = '';
1639 1772 if (is_singular() && $this->current_post_id) {
1640 1773 if (!empty($og_image_override)) {
1774 + $primary_og_image = (string) $og_image_override;
1641 1775 echo "<meta property=\"og:image\" content=\"" . esc_url($og_image_override) . "\" />\n";
1642 1776 echo "<meta property=\"og:image:secure_url\" content=\"" . esc_url($og_image_override) . "\" />\n";
1643 1777 } elseif (has_post_thumbnail($this->current_post_id)) {
1644 1778 $image_url = get_the_post_thumbnail_url($this->current_post_id, 'large');
1779 + $primary_og_image = (string) $image_url;
1645 1780 echo "<meta property=\"og:image\" content=\"" . esc_url($image_url) . "\" />\n";
1646 1781 echo "<meta property=\"og:image:secure_url\" content=\"" . esc_url($image_url) . "\" />\n";
1647 1782
1648 1783 // Get image dimensions and alt text
@@ -1671,8 +1806,30 @@
1671 1806 echo "<meta property=\"og:image:alt\" content=\"" . esc_attr($image_alt) . "\" />\n";
1672 1807 }
1673 1808 }
1674 1809
1810 + // Alternatives, same as the enhanced emitter above. This path only
1811 + // runs when the Social Meta Manager is unavailable, but the issue
1812 + // reported against it (#636) and a site that lands here should not
1813 + // silently lose a feature it switched on.
1814 + if (!empty($primary_og_image)) {
1815 + $social_settings = $this->social_manager
1816 + ? $this->social_manager->get_settings(
1817 + $this->current_context === 'homepage' ? 'site' : $this->current_context,
1818 + $this->current_post_id
1819 + )
1820 + : [];
1821 +
1822 + if (!empty($social_settings['og_multiple_images'])) {
1823 + self::output_extra_og_images(
1824 + \ThinkRank\SEO\Social_Images::additional(
1825 + (int) $this->current_post_id,
1826 + $primary_og_image
1827 + )
1828 + );
1829 + }
1830 + }
1831 +
1675 1832 // Add article specific tags for posts only
1676 1833 if ($og_type === 'article') {
1677 1834 echo '<meta property="article:published_time" content="' . esc_attr(get_the_date('c', $this->current_post_id)) . '" />' . "\n";
1678 1835 echo '<meta property="article:modified_time" content="' . esc_attr(get_the_modified_date('c', $this->current_post_id)) . '" />' . "\n";
@@ -1798,9 +1955,9 @@
1798 1955 // "There is no excerpt because this is a protected post." placeholder,
1799 1956 // so this is not a leak — but publishing that sentence as the social
1800 1957 // description is worse than publishing none (#363).
1801 1958 if (!$description && !$this->is_content_password_protected()) {
1802 - $description = is_singular() ? wp_trim_words(get_the_excerpt(), 30) : get_bloginfo('description');
1959 + $description = is_singular() ? \ThinkRank\Core\Seo_Text::trim_words(get_the_excerpt(), 30) : get_bloginfo('description');
1803 1960 }
1804 1961
1805 1962 // Determine card type based on image availability
1806 1963 $card_type = 'summary';
@@ -1809,9 +1966,9 @@
1809 1966 }
1810 1967
1811 1968 echo "<!-- ThinkRank SEO Twitter Card Meta Tags -->\n";
1812 1969 echo '<meta name="twitter:card" content="' . esc_attr($card_type) . '" />' . "\n";
1813 - echo "<meta name=\"twitter:title\" content=\"" . esc_attr($title) . "\" />\n";
1970 + echo "<meta name=\"twitter:title\" content=\"" . esc_attr(self::strip_title_tags($title)) . "\" />\n";
1814 1971 echo "<meta name=\"twitter:description\" content=\"" . esc_attr($description) . "\" />\n";
1815 1972
1816 1973 // Add Twitter image with proper fallback priority
1817 1974 $twitter_image_url = $this->get_twitter_image_with_fallback();
@@ -1886,8 +2043,13 @@
1886 2043 if (empty($canonical_url)) {
1887 2044 return;
1888 2045 }
1889 2046
2047 + // After the filter, so a canonical an add-on supplied is normalized
2048 + // too — and a cross-domain one is left alone, since Url_Scheme only
2049 + // touches URLs on this site's own host.
2050 + $canonical_url = \ThinkRank\SEO\Url_Scheme::apply($canonical_url);
2051 +
1890 2052 echo "<!-- ThinkRank SEO Canonical URL -->\n";
1891 2053 echo "<link rel=\"canonical\" href=\"" . esc_url($canonical_url) . "\" />\n";
1892 2054 echo "<!-- /ThinkRank SEO Canonical URL -->\n";
1893 2055
@@ -1934,9 +2096,9 @@
1934 2096
1935 2097 if ($current > 1) {
1936 2098 printf(
1937 2099 "<link rel=\"prev\" href=\"%s\" />\n",
1938 - esc_url(self::with_pagination($base, $current - 1))
2100 + esc_url(\ThinkRank\SEO\Url_Scheme::apply(self::with_pagination($base, $current - 1)))
1939 2101 );
1940 2102 }
1941 2103
1942 2104 if ($current < $total) {
@@ -1941,9 +2103,9 @@
1941 2103
1942 2104 if ($current < $total) {
1943 2105 printf(
1944 2106 "<link rel=\"next\" href=\"%s\" />\n",
1945 - esc_url(self::with_pagination($base, $current + 1))
2107 + esc_url(\ThinkRank\SEO\Url_Scheme::apply(self::with_pagination($base, $current + 1)))
1946 2108 );
1947 2109 }
1948 2110 }
1949 2111
@@ -2443,9 +2605,9 @@
2443 2605 // Stripped: get_the_archive_title() wraps its subject in a
2444 2606 // <span>, and this placeholder feeds the document <title> as
2445 2607 // well as og:title and twitter:title — a date archive rendered
2446 2608 // as "Month: <span>August 2026</span> | Site".
2447 - $placeholders['%archive_title%'] = wp_strip_all_tags((string) get_the_archive_title());
2609 + $placeholders['%archive_title%'] = self::archive_subject();
2448 2610 break;
2449 2611
2450 2612 case 'homepage':
2451 2613 // The page template resolved for a static posts page needs the
@@ -2640,11 +2802,13 @@
2640 2802 if ($description === '') {
2641 2803 return null;
2642 2804 }
2643 2805
2644 - if (strlen($description) > 160) {
2645 - $description = wp_trim_words($description, 25, '...');
2646 - }
2806 + // Measure and cut in CHARACTERS. strlen() counts bytes, so a Thai or
2807 + // CJK description tripped this limit at a third of its length, and
2808 + // wp_trim_words() then cut by a unit the locale chooses — 25 words in
2809 + // English, 25 characters in Thai (#687).
2810 + $description = \ThinkRank\Core\Seo_Text::trim_to_length($description);
2647 2811
2648 2812 return $description;
2649 2813 }
2650 2814
@@ -2691,11 +2855,13 @@
2691 2855 $description = preg_replace('/\s+/', ' ', $description);
2692 2856 $description = trim($description);
2693 2857
2694 2858 // Ensure description doesn't exceed recommended length (160 characters)
2695 - if (strlen($description) > 160) {
2696 - $description = wp_trim_words($description, 25, '...');
2697 - }
2859 + // Measure and cut in CHARACTERS. strlen() counts bytes, so a Thai or
2860 + // CJK description tripped this limit at a third of its length, and
2861 + // wp_trim_words() then cut by a unit the locale chooses — 25 words in
2862 + // English, 25 characters in Thai (#687).
2863 + $description = \ThinkRank\Core\Seo_Text::trim_to_length($description);
2698 2864
2699 2865 return $description;
2700 2866 }
2701 2867
@@ -2845,17 +3011,41 @@
2845 3011 if (!empty($description)) {
2846 3012 $schema['description'] = $description;
2847 3013 }
2848 3014
2849 - $schema['potentialAction'] = [
2850 - '@type' => 'SearchAction',
2851 - 'target' => [
2852 - '@type' => 'EntryPoint',
2853 - 'urlTemplate' => home_url('/?s={search_term_string}'),
2854 - ],
2855 - 'query-input' => 'required name=search_term_string',
2856 - ];
3015 + // Site Identity has accepted an alternate name since the setup wizard
3016 + // shipped, and the MCP ability describes it as "published as schema
3017 + // alternateName" — but no producer ever read it, so the promise was
3018 + // false and every imported Yoast/Rank Math value sat unused (#692).
3019 + $alternate_name = \ThinkRank\SEO\Site_Identity_Manager::alternate_name_for_schema($settings['alternate_name'] ?? null);
3020 + if (null !== $alternate_name) {
3021 + $schema['alternateName'] = $alternate_name;
3022 + }
2857 3023
3024 + // The sitelinks searchbox switch was honoured only for a deployed
3025 + // WebSite row; this live fallback added potentialAction unconditionally,
3026 + // so website_enable_search = 0 still shipped the SearchAction (#688).
3027 + // Absent means not configured, which stays enabled.
3028 + $search_enabled = true;
3029 + if ($this->schema_manager) {
3030 + $schema_settings = $this->schema_manager->get_settings('site', null);
3031 +
3032 + if (array_key_exists('website_enable_search', $schema_settings)) {
3033 + $search_enabled = !empty($schema_settings['website_enable_search']);
3034 + }
3035 + }
3036 +
3037 + if ($search_enabled) {
3038 + $schema['potentialAction'] = [
3039 + '@type' => 'SearchAction',
3040 + 'target' => [
3041 + '@type' => 'EntryPoint',
3042 + 'urlTemplate' => home_url('/?s={search_term_string}'),
3043 + ],
3044 + 'query-input' => 'required name=search_term_string',
3045 + ];
3046 + }
3047 +
2858 3048 return $schema;
2859 3049 }
2860 3050
2861 3051 /**
@@ -3064,8 +3254,22 @@
3064 3254
3065 3255 // Only output if breadcrumbs are enabled
3066 3256 if (empty($settings['breadcrumbs_enabled'])) {
3067 3257 return;
3258 + }
3259 +
3260 + // Schema Manager's own breadcrumb switch. Only Site Identity's
3261 + // breadcrumbs_enabled was consulted here, so enable_breadcrumbs_schema
3262 + // = 0 removed a deployed BreadcrumbList row and left this live one
3263 + // emitting the node anyway (#688). Absent means not configured, which
3264 + // stays enabled.
3265 + if ($this->schema_manager) {
3266 + $schema_settings = $this->schema_manager->get_settings('site', null);
3267 +
3268 + if (array_key_exists('enable_breadcrumbs_schema', $schema_settings)
3269 + && empty($schema_settings['enable_breadcrumbs_schema'])) {
3270 + return;
3271 + }
3068 3272 }
3069 3273
3070 3274 $breadcrumbs = $this->generate_breadcrumbs($settings);
3071 3275