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:
Claudio Sanches 2015-09-15 13:15:20 -03:00
commit d7c25e3051
1 changed files with 10 additions and 0 deletions

View File

@ -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 ) ) {