PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.7.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.7.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 1.10.0 All 48 releases
← All changes | includes/seo/class-pattern-resolver.php +14 -5 2.6.02.7.0 View file →
@@ -165,9 +165,14 @@
165 165 $text = excerpt_remove_blocks($content);
166 166 $text = strip_shortcodes($text);
167 167 $text = wp_strip_all_tags($text);
168 168
169 - return trim(wp_trim_words($text, $words, '...'));
169 + // $words is a WORD cap, but wp_trim_words() counts CHARACTERS on
170 + // th/ja/zh_*, where it would cut to ~25 characters instead of ~25
171 + // words — about six times too short (#687). trim_words() keeps the
172 + // word cap where words are the unit and falls back to a character
173 + // budget where they are not.
174 + return trim(\ThinkRank\Core\Seo_Text::trim_words($text, $words));
170 175 }
171 176
172 177 /**
173 178 * Resolve any variable-tag string against a term's values.
@@ -215,10 +220,12 @@
215 220 '%title%' => $name,
216 221 '%term%' => $name,
217 222 '%sitename%' => get_bloginfo('name'),
218 223 '%sep%' => self::separator(),
224 + // Same locale trap as derive_excerpt(): a word cap here is a
225 + // ~25-character cap on th/ja/zh_* (#687).
219 226 '%excerpt%' => $description !== ''
220 - ? wp_trim_words(wp_strip_all_tags($description), 25, '...')
227 + ? self::derive_excerpt($description)
221 228 : '',
222 229 '%date%' => '',
223 230 '%modified%' => '',
224 231 '%author%' => '',
@@ -253,11 +260,13 @@
253 260 public static function description(int $post_id): string {
254 261 $template = self::template_for($post_id, 'description', self::DEFAULT_DESCRIPTION);
255 262 $description = self::resolve_value($template, $post_id);
256 263
257 - if (strlen($description) > 160) {
258 - $description = wp_trim_words($description, 25, '...');
259 - }
264 + // Measure and cut in CHARACTERS. strlen() counts bytes, so a Thai or
265 + // CJK description tripped this limit at a third of its length, and
266 + // wp_trim_words() then cut by a unit the locale chooses — 25 words in
267 + // English, 25 characters in Thai (#687).
268 + $description = \ThinkRank\Core\Seo_Text::trim_to_length($description);
260 269
261 270 return $description;
262 271 }
263 272