PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.14.2
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.14.2
2.14.2 2.14.1 2.14.0 2.13.0 2.12.0 2.11.0 2.10.0 2.9.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 All 57 releases
← All changes | includes/abilities/content/class-get-post-content.php +24 -11 2.7.0 → 2.14.2 View file →
@@ -10,8 +10,9 @@
10 10 namespace ThinkRank\Abilities\Content;
11 11
12 12 use ThinkRank\Abilities\Ability_Base;
13 13 use ThinkRank\SEO\Builder_Content;
14 +use ThinkRank\SEO\Word_Count_Index;
14 15
15 16 if ( ! defined( 'ABSPATH' ) ) {
16 17 exit; // Exit if accessed directly.
17 18 }
@@ -44,9 +45,9 @@
44 45 */
45 46 public function __construct() {
46 47 $this->id = 'thinkrank/get-post-content';
47 48 $this->label = __( 'Get ThinkRank Post Content', 'thinkrank' );
48 - $this->description = __( 'Read a post or page\'s body content so you can judge what it is about before changing its SEO fields. Returns the text the page actually renders — resolved from the page builder when one owns the page — plus the raw stored post_content and which builder is in use. Read-only: use update-post-seo to change SEO fields. Use list-content-items to find ids.', 'thinkrank' );
49 + $this->description = __( 'Read a post or page\'s body content so you can judge what it is about before changing its SEO fields. Returns the text the page actually renders, resolved from the page builder when one owns the page, plus the raw stored post_content and which builder is in use. Read-only: use update-post-seo to change SEO fields. Use list-content-items to find ids.', 'thinkrank' );
49 50 }
50 51
51 52 /**
52 53 * {@inheritDoc}
@@ -158,11 +159,18 @@
158 159 [ 'status' => 403 ]
159 160 );
160 161 }
161 162
162 - $resolved = trim( wp_strip_all_tags( Builder_Content::resolve( $post ) ) );
163 - $builder = $this->builder_for( $post_id );
163 + $source = Builder_Content::resolve( $post );
164 + $resolved = trim( wp_strip_all_tags( $source ) );
165 + // Counted over the reading text rather than the body returned, so shortcode
166 + // syntax is not counted as words and two words split only by a tag stay
167 + // two (#893), and a token of punctuation alone is not a word. Words,
168 + // whatever the locale: the field says words.
169 + $reading = Word_Count_Index::reading_text( $source );
164 170
171 + $builder = $this->builder_for( $post_id );
172 +
165 173 $body = $resolved;
166 174 $truncated = false;
167 175
168 176 if ( isset( $input['max_chars'] ) ) {
@@ -185,9 +193,9 @@
185 193 'content' => $body,
186 194 'post_content' => (string) $post->post_content,
187 195 'content_source' => null === $builder ? 'post_content' : 'builder',
188 196 'builder' => $builder,
189 - 'word_count' => '' === $resolved ? 0 : count( preg_split( '/\s+/u', $resolved ) ?: [] ),
197 + 'word_count' => Word_Count_Index::count_words( $reading ),
190 198 'truncated' => $truncated,
191 199 ];
192 200 }
193 201
@@ -206,16 +214,21 @@
206 214 }
207 215
208 216 // Same keys Builder_Content resolves through, in the same order. Kept
209 217 // as a local map because this one also needs a display label per key,
210 - // and Oxygen spans three of them across its generations — Oxygen 6 is
211 - // Breakdance under the hood.
218 + // and Oxygen spans several of them across its generations — Oxygen 6 is
219 + // Breakdance under the hood, and Oxygen classic 4.8.3+ prefixes its
220 + // keys with an underscore. Missing the JSON and prefixed keys, a
221 + // current Oxygen classic page was reported as built in no builder.
212 222 $labels = [
213 - '_breakdance_data' => 'breakdance',
214 - '_oxygen_data' => 'oxygen',
215 - 'ct_builder_shortcodes' => 'oxygen',
216 - '_elementor_data' => 'elementor',
217 - '_fl_builder_data' => 'beaver-builder',
223 + '_breakdance_data' => 'breakdance',
224 + '_oxygen_data' => 'oxygen',
225 + '_ct_builder_json' => 'oxygen',
226 + 'ct_builder_json' => 'oxygen',
227 + '_ct_builder_shortcodes' => 'oxygen',
228 + 'ct_builder_shortcodes' => 'oxygen',
229 + '_elementor_data' => 'elementor',
230 + '_fl_builder_data' => 'beaver-builder',
218 231 ];
219 232
220 233 foreach ( $labels as $key => $label ) {
221 234 $stored = get_post_meta( $post_id, $key, true );