Make WordPress Core


Ignore:
Timestamp:
04/13/2012 08:23:31 PM (14 years ago)
Author:
nacin
Message:

Move from 'featured image' to 'post thumbnail' in the XML-RPC API. props maxcutler, fixes #20396.

File:
1 edited

Legend:

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

    r20406 r20462  
    345345                                'option'        => 'stylesheet'
    346346                        ),
    347                         'featured_image'    => array(
    348                                 'desc'          => __('Featured Image'),
     347                        'post_thumbnail'    => array(
     348                                'desc'          => __('Post Thumbnail'),
    349349                                'readonly'      => true,
    350350                                'value'         => current_theme_supports( 'post-thumbnails' )
     
    596596
    597597                //
    598                 $post_fields['featured_image']     = get_post_meta( $post['ID'], '_thumbnail_id', true );
    599                 $post_fields['featured_image_url'] = wp_get_attachment_url( $post_fields['featured_image'] );
     598                $post_fields['post_thumbnail']     = get_post_meta( $post['ID'], '_thumbnail_id', true );
     599                $post_fields['post_thumbnail_url'] = wp_get_attachment_url( $post_fields['post_thumbnail'] );
    600600
    601601                // Consider future posts as published
     
    723723         *      - ping_status - can be 'open' | 'closed'
    724724         *      - sticky
    725          *      - featured_image - ID of a media item to use as the featured image
     725         *      - post_thumbnail - ID of a media item to use as the post thumbnail/featured image
    726726         *      - custom_fields - array, with each element containing 'key' and 'value'
    727727         *      - terms - array, with taxonomy names as keys and arrays of term IDs as values
     
    857857                }
    858858
    859                 if ( isset ( $post_data['featured_image'] ) ) {
     859                if ( isset ( $post_data['post_thumbnail'] ) ) {
    860860                        // empty value deletes, non-empty value adds/updates
    861                         if ( empty( $post_data['featured_image'] ) ) {
     861                        if ( empty( $post_data['post_thumbnail'] ) ) {
    862862                                delete_post_thumbnail( $post_ID );
    863863                        }
    864864                        else {
    865                                 if ( set_post_thumbnail( $post_ID, $post_data['featured_image'] ) === false )
     865                                if ( set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) === false )
    866866                                        return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
    867867                        }
    868                         unset( $content_struct['featured_image'] );
     868                        unset( $content_struct['post_thumbnail'] );
    869869                }
    870870
     
    35043504         *  - date_created_gmt
    35053505         *  - dateCreated
    3506          *  - wp_featured_image
     3506         *  - wp_post_thumbnail
    35073507         *
    35083508         * @since 1.5.0
     
    37543754                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
    37553755
    3756                 if ( isset ( $content_struct['wp_featured_image'] ) ) {
    3757                         if ( set_post_thumbnail( $post_ID, $content_struct['wp_featured_image'] ) === false )
     3756                if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
     3757                        if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
    37583758                                return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
    37593759
    3760                         unset( $content_struct['wp_featured_image'] );
     3760                        unset( $content_struct['wp_post_thumbnail'] );
    37613761                }
    37623762
     
    40674067                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
    40684068
    4069                 if ( isset ( $content_struct['wp_featured_image'] ) ) {
     4069                if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
    40704070                        // empty value deletes, non-empty value adds/updates
    4071                         if ( empty( $content_struct['wp_featured_image'] ) ) {
     4071                        if ( empty( $content_struct['wp_post_thumbnail'] ) ) {
    40724072                                delete_post_thumbnail( $post_ID );
    40734073                        } else {
    4074                                 if ( set_post_thumbnail( $post_ID, $content_struct['wp_featured_image'] ) === false )
     4074                                if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
    40754075                                        return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
    40764076                        }
    4077                         unset( $content_struct['wp_featured_image'] );
     4077                        unset( $content_struct['wp_post_thumbnail'] );
    40784078                }
    40794079
     
    42084208                        if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
    42094209
    4210                         $resp['wp_featured_image'] = get_post_meta( $postdata['ID'], '_thumbnail_id', true );
    4211                         $resp['wp_featured_image_url'] = wp_get_attachment_url( $resp['wp_featured_image'] );
     4210                        $resp['wp_post_thumbnail'] = get_post_meta( $postdata['ID'], '_thumbnail_id', true );
     4211                        $resp['wp_post_thumbnail_url'] = wp_get_attachment_url( $resp['wp_post_thumbnail'] );
    42124212
    42134213                        return $resp;
     
    43204320
    43214321                        $entry_index = count( $struct ) - 1;
    4322                         $struct[ $entry_index ][ 'wp_featured_image' ]     = get_post_meta( $entry['ID'], '_thumbnail_id', true );
    4323                         $struct[ $entry_index ][ 'wp_featured_image_url' ] = wp_get_attachment_url( $struct[ $entry_index ][ 'wp_featured_image' ] );
     4322                        $struct[ $entry_index ][ 'wp_post_thumbnail' ]     = get_post_meta( $entry['ID'], '_thumbnail_id', true );
     4323                        $struct[ $entry_index ][ 'wp_post_thumbnail_url' ] = wp_get_attachment_url( $struct[ $entry_index ][ 'wp_post_thumbnail' ] );
    43244324                }
    43254325
Note: See TracChangeset for help on using the changeset viewer.