Make WordPress Core


Ignore:
Timestamp:
09/20/2023 07:29:30 PM (9 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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        update_post_meta( $this->attachment_id, '_wp_attachment_image_alt', 'Waffle has alt text' );
    2829
    2930        set_post_thumbnail( self::$post_id, $this->attachment_id );
     
    6162        $this->assertIsString( $result['thumbnail'] );
    6263        $this->assertIsArray( $result['metadata'] );
     64        $this->assertIsString( $result['alt'] );
    6365
    6466        // Check expected values.
Note: See TracChangeset for help on using the changeset viewer.