← All changes
|
includes/abilities/analysis/class-get-post-seo-checks.php
+12
-2
1.25.0
→
2.10.0
View file →
| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | use ThinkRank\Abilities\Ability_Base; |
| 13 | 13 | use ThinkRank\Admin\Metabox_Manager; |
| 14 | 14 | use ThinkRank\AI\SEOScoreCalculator; |
| 15 | 15 | use ThinkRank\Core\Database; |
| 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-post-seo-checks'; |
| 30 | 31 | $this->label = __( 'Get ThinkRank Post SEO Checks', 'thinkrank' ); |
| 31 | - $this->description = __( 'Run ThinkRank SEO score analysis for one or more posts, pages, or custom post type items.', 'thinkrank' ); | |
| 32 | + $this->description = __( 'Run ThinkRank SEO score analysis for one or more posts, pages, or custom post type items. Scores are not persisted; use bulk-analyze-and-save to score and store them.', 'thinkrank' ); | |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | /** |
| 35 | 36 | * {@inheritDoc} |
| @@ -115,9 +116,18 @@ | ||
| 115 | 116 | |
| 116 | 117 | foreach ( $post_ids as $post_id ) { |
| 117 | 118 | try { |
| 118 | 119 | $content = $calculator->analyze_post_content( $post_id ); |
| 119 | - $score = $calculator->calculate_score( $content, $metabox->get_post_metadata( $post_id ) ); | |
| 120 | + | |
| 121 | + // Override the raw per-post title/description with their effective | |
| 122 | + // values (custom value, else the resolved Global pattern) so an | |
| 123 | + // inherited title or description is scored as present — matching | |
| 124 | + // the editor and frontend — instead of counting as missing. | |
| 125 | + $metadata = $metabox->get_post_metadata( $post_id ); | |
| 126 | + $metadata['title'] = Pattern_Resolver::effective_title( $post_id ); | |
| 127 | + $metadata['description'] = Pattern_Resolver::effective_description( $post_id ); | |
| 128 | + | |
| 129 | + $score = $calculator->calculate_score( $content, $metadata ); | |
| 120 | 130 | |
| 121 | 131 | $data[] = [ |
| 122 | 132 | 'post_id' => $post_id, |
| 123 | 133 | 'score' => $score, |