Make the image properties alt and title writable in the REST API v3.

This commit is contained in:
Mikael Mattsson 2015-09-15 17:17:14 +02:00
parent 7af7f1f6da
commit ac49411146
1 changed files with 10 additions and 0 deletions

View File

@ -1768,6 +1768,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 ) ) {