← All changes
|
includes/abilities/analysis/class-get-seo-score.php
+8
-3
1.25.0
→
2.10.0
View file →
| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | use ThinkRank\Abilities\Ability_Base; |
| 13 | 13 | use ThinkRank\AI\SEOScoreCalculator; |
| 14 | 14 | use ThinkRank\Core\Database; |
| 15 | 15 | use ThinkRank\SEO\Focus_Keywords; |
| 16 | +use ThinkRank\SEO\Pattern_Resolver; | |
| 16 | 17 | |
| 17 | 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | 19 | exit; // Exit if accessed directly. |
| 19 | 20 | } |
| @@ -27,9 +28,9 @@ | ||
| 27 | 28 | */ |
| 28 | 29 | public function __construct() { |
| 29 | 30 | $this->id = 'thinkrank/get-seo-score'; |
| 30 | 31 | $this->label = __( 'Get ThinkRank SEO Score', 'thinkrank' ); |
| 31 | - $this->description = __( 'Calculate the ThinkRank SEO score for a single post, analyzing its content against its configured title and meta description.', 'thinkrank' ); | |
| 32 | + $this->description = __( 'Calculate the ThinkRank SEO score for a single post, analyzing its content against its configured title and meta description. Use get-post-seo-checks for several posts at once, or bulk-analyze-and-save to score and persist them.', 'thinkrank' ); | |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | /** |
| 35 | 36 | * {@inheritDoc} |
| @@ -119,11 +120,15 @@ | ||
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | // Carry the stored focus keywords so keyword-dependent factors are |
| 122 | 123 | // actually measured instead of scoring as "no focus keyword set". |
| 124 | + // Score against the FINAL effective title/description (custom value, else | |
| 125 | + // the resolved Global pattern), so a post that inherits its title or | |
| 126 | + // description from a global pattern scores the same here as in the editor | |
| 127 | + // and on the frontend — not as if those fields were missing. | |
| 123 | 128 | $metadata = [ |
| 124 | - 'title' => get_post_meta( $post_id, '_thinkrank_seo_title', true ), | |
| 125 | - 'description' => get_post_meta( $post_id, '_thinkrank_meta_description', true ), | |
| 129 | + 'title' => Pattern_Resolver::effective_title( $post_id ), | |
| 130 | + 'description' => Pattern_Resolver::effective_description( $post_id ), | |
| 126 | 131 | 'focus_keywords' => Focus_Keywords::get( $post_id ), |
| 127 | 132 | ]; |
| 128 | 133 | |
| 129 | 134 | $score = $calc->calculate_score( $content, $metadata ); |