PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.12.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.12.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 1.27.0 1.26.0 1.25.0 trunk All 53 releases
← All changes | includes/abilities/media/class-update-image-alt-text.php +9 -3 2.8.0 → 2.12.0 View file →
@@ -32,9 +32,9 @@
32 32 */
33 33 public function __construct() {
34 34 $this->id = 'thinkrank/update-image-alt-text';
35 35 $this->label = __( 'Update ThinkRank Image Alt Text', 'thinkrank' );
36 - $this->description = __( 'Set one image\'s alt text in the Media Library. Pass alt_text to write specific words, or generate: true to build one from the site\'s alt text template. Existing alt text is kept unless overwrite is true, so a sweep never replaces what an author wrote. Returns the stored value. Call get-image-alt-text to read the current value first, list-images to find ids, or fill-missing-alt-text to do the whole library at once.', 'thinkrank' );
36 + $this->description = __( 'Set one image\'s alt text in the Media Library. Pass alt_text to write specific words, or generate: true to build one from the site\'s alt text template. Existing alt text is kept unless overwrite is true, so a sweep never replaces what an author wrote. Returns the stored value. Call get-image-alt-text to read the current value first, list-images to find ids, or fill-missing-alt-text to do the whole library at once. Caches holding the old alt text are cleared where possible; check cache.warnings and pass on anything the user still has to clear by hand.', 'thinkrank' );
37 37 }
38 38
39 39 /**
40 40 * {@inheritDoc}
@@ -97,9 +97,10 @@
97 97 'type' => 'boolean',
98 98 'description' => __( 'True when the image already had alt text and overwrite was not set. Nothing was changed.', 'thinkrank' ),
99 99 ],
100 100 ],
101 - $this->image_properties()
101 + $this->image_properties(),
102 + [ 'cache' => $this->cache_property() ]
102 103 ),
103 104 ];
104 105 }
105 106
@@ -145,8 +146,12 @@
145 146 // sanitize_text_field(), matching what the Media Library itself
146 147 // stores: alt text is a plain-text attribute, and markup in it is
147 148 // escaped into visible noise rather than rendered.
148 149 update_post_meta( $attachment_id, self::ALT_META_KEY, sanitize_text_field( (string) $input['alt_text'] ) );
150 +
151 + // fill_attachment_alt() purges for itself; this branch writes the
152 + // meta directly, so it has to ask for the same thing (#763).
153 + $this->manager()->purge_alt_caches( [ $attachment_id ] );
149 154 } elseif ( ! $this->manager()->fill_attachment_alt( $attachment_id, true ) ) {
150 155 return new \WP_Error(
151 156 'thinkrank_alt_generation_failed',
152 157 __( 'The alt text template produced no value for this image. Set alt_text explicitly, or review the template under Essential SEO → Image SEO.', 'thinkrank' ),
@@ -158,8 +163,9 @@
158 163 [
159 164 'success' => true,
160 165 'skipped' => false,
161 166 ],
162 - $this->describe_image( $attachment_id )
167 + $this->describe_image( $attachment_id ),
168 + [ 'cache' => $this->cache_outcome() ]
163 169 );
164 170 }
165 171 }