| @@ -59,8 +59,23 @@ | ||
| 59 | 59 | */ |
| 60 | 60 | private bool $measured_performance_resolved = false; |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | + * Length bands the editor scores against, in characters. | |
| 64 | + * | |
| 65 | + * Public so every surface that judges a title or description — the editor | |
| 66 | + * score and the Bulk Snippets problem filter — reads one set of numbers. | |
| 67 | + * Before these existed the bands were literals inside the scoring methods, | |
| 68 | + * and a second screen would have had to copy them and drift (#727). | |
| 69 | + * | |
| 70 | + * @since 2.8.0 | |
| 71 | + */ | |
| 72 | + public const TITLE_OPTIMAL_MIN = 35; | |
| 73 | + public const TITLE_OPTIMAL_MAX = 60; | |
| 74 | + public const DESCRIPTION_OPTIMAL_MIN = 120; | |
| 75 | + public const DESCRIPTION_OPTIMAL_MAX = 160; | |
| 76 | + | |
| 77 | + /** | |
| 63 | 78 | * 2025 SEO scoring factors (Q1 2025 Google Algorithm) |
| 64 | 79 | * Based on First Page Sage research and Google's latest updates |
| 65 | 80 | * |
| 66 | 81 | * @var array |
| @@ -647,9 +662,9 @@ | ||
| 647 | 662 | $title_length = mb_strlen($title); |
| 648 | 663 | |
| 649 | 664 | // 2025 length optimization (6 points). 60 characters is the recommended |
| 650 | 665 | // maximum for best SERP visibility before Google truncates the title. |
| 651 | - if ($title_length >= 35 && $title_length <= 60) { | |
| 666 | + if ($title_length >= self::TITLE_OPTIMAL_MIN && $title_length <= self::TITLE_OPTIMAL_MAX) { | |
| 652 | 667 | $score += 6; |
| 653 | 668 | } elseif ($title_length >= 25 && $title_length <= 75) { |
| 654 | 669 | $score += 4; |
| 655 | 670 | $suggestions[] = 'Optimize title length to 35-60 characters for better SERP visibility'; |
| @@ -2166,9 +2181,9 @@ | ||
| 2166 | 2181 | $suggestions = []; |
| 2167 | 2182 | |
| 2168 | 2183 | // Meta description check |
| 2169 | 2184 | $meta_desc = $metadata['description'] ?? ''; |
| 2170 | - if (!empty($meta_desc) && mb_strlen($meta_desc) >= 120 && mb_strlen($meta_desc) <= 160) { | |
| 2185 | + if (!empty($meta_desc) && mb_strlen($meta_desc) >= self::DESCRIPTION_OPTIMAL_MIN && mb_strlen($meta_desc) <= self::DESCRIPTION_OPTIMAL_MAX) { | |
| 2171 | 2186 | $score += 0.5; |
| 2172 | 2187 | } else { |
| 2173 | 2188 | $suggestions[] = 'Add a compelling meta description (120-160 characters)'; |
| 2174 | 2189 | } |