XML-RPC: Add alt attribute value to media item API.

Add alt text to the `wp.getMediaItem` method in the XML-RPC API. Allows users to fetch alt text as a first-class member of a media object.

Props thomashorta, joedolson, jivygraphics, stephenerdelyi, mukesh27, whyisjake.
Fixes #58582.

git-svn-id: https://develop.svn.wordpress.org/trunk@56637 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson
2023-09-20 19:29:30 +00:00
parent 107c730164
commit 5b79a4cd49
2 changed files with 3 additions and 0 deletions

View File

@@ -1067,6 +1067,7 @@ class wp_xmlrpc_server extends IXR_Server {
'description' => $media_item->post_content,
'metadata' => wp_get_attachment_metadata( $media_item->ID ),
'type' => $media_item->post_mime_type,
'alt' => get_post_meta( $media_item->ID, '_wp_attachment_image_alt', true ),
);
$thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );