Automattic\WooCommerce\RestApi\Utilities
ImageAttachment::update_alt_text
Update attachment alt text.
Method of the class: ImageAttachment{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ImageAttachment = new ImageAttachment(); $ImageAttachment->update_alt_text( $text );
- $text(string) (required)
- Text to set.
ImageAttachment::update_alt_text() ImageAttachment::update alt text code WC 10.5.0
public function update_alt_text( $text ) {
if ( ! $this->id ) {
return;
}
update_post_meta( $this->id, '_wp_attachment_image_alt', wc_clean( $text ) );
}