← All changes
|
includes/abilities/media/class-update-image-alt-text.php
+3
-9
trunk
→
2.11.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. 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' ); | |
| 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' ); | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * {@inheritDoc} |
| @@ -97,10 +97,9 @@ | ||
| 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(), | |
| 102 | - [ 'cache' => $this->cache_property() ] | |
| 101 | + $this->image_properties() | |
| 103 | 102 | ), |
| 104 | 103 | ]; |
| 105 | 104 | } |
| 106 | 105 | |
| @@ -146,12 +145,8 @@ | ||
| 146 | 145 | // sanitize_text_field(), matching what the Media Library itself |
| 147 | 146 | // stores: alt text is a plain-text attribute, and markup in it is |
| 148 | 147 | // escaped into visible noise rather than rendered. |
| 149 | 148 | 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 ] ); | |
| 154 | 149 | } elseif ( ! $this->manager()->fill_attachment_alt( $attachment_id, true ) ) { |
| 155 | 150 | return new \WP_Error( |
| 156 | 151 | 'thinkrank_alt_generation_failed', |
| 157 | 152 | __( 'The alt text template produced no value for this image. Set alt_text explicitly, or review the template under Essential SEO → Image SEO.', 'thinkrank' ), |
| @@ -163,9 +158,8 @@ | ||
| 163 | 158 | [ |
| 164 | 159 | 'success' => true, |
| 165 | 160 | 'skipped' => false, |
| 166 | 161 | ], |
| 167 | - $this->describe_image( $attachment_id ), | |
| 168 | - [ 'cache' => $this->cache_outcome() ] | |
| 162 | + $this->describe_image( $attachment_id ) | |
| 169 | 163 | ); |
| 170 | 164 | } |
| 171 | 165 | } |