Make WordPress Core

Changeset 56637

Timestamp:
09/20/2023 07:29:30 PM (11 months ago)
Author:
joedolson
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r56480 r56637  
    10681068            'metadata'         => wp_get_attachment_metadata( $media_item->ID ),
    10691069            'type'             => $media_item->post_mime_type,
     1070
    10701071        );
    10711072
  • trunk/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php

    r52010 r56637  
    2626        $this->attachment_id   = $this->_make_attachment( $upload, self::$post_id );
    2727        $this->attachment_data = get_post( $this->attachment_id, ARRAY_A );
     28
    2829
    2930        set_post_thumbnail( self::$post_id, $this->attachment_id );
     
    6162        $this->assertIsString( $result['thumbnail'] );
    6263        $this->assertIsArray( $result['metadata'] );
     64
    6365
    6466        // Check expected values.
Note: See TracChangeset for help on using the changeset viewer.