Merge pull request #9136 from mikaelmattsson/master
Make the image properties alt and title writable in the REST API v3, closes #8860
This commit is contained in:
commit
d7c25e3051
|
@ -2195,6 +2195,16 @@ class WC_API_Products extends WC_API_Resource {
|
|||
$gallery[] = $attachment_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the image alt if present.
|
||||
if ( ! empty( $image['alt'] ) ) {
|
||||
update_post_meta( $attachment_id, '_wp_attachment_image_alt', $image['alt'] );
|
||||
}
|
||||
|
||||
// Set the image title if present.
|
||||
if ( ! empty( $image['title'] ) ) {
|
||||
wp_update_post( array( 'ID' => $attachment_id, 'post_title' => $image['title'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $gallery ) ) {
|
||||
|
|
Loading…
Reference in New Issue