Changeset 20270
- Timestamp:
- 03/23/2012 03:35:44 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-xmlrpc-server.php
r20215 r20270 578 578 ); 579 579 580 // 581 $post_fields['featured_image'] = get_post_meta( $post['ID'], '_thumbnail_id', true ); 582 $post_fields['featured_image_url'] = wp_get_attachment_url( $post_fields['featured_image'] ); 583 580 584 // Consider future posts as published 581 585 if ( $post_fields['post_status'] === 'future' ) … … 645 649 * - ping_status - can be 'open' | 'closed' 646 650 * - sticky 651 * - featured_image - ID of a media item to use as the featured image 647 652 * - custom_fields - array, with each element containing 'key' and 'value' 648 653 * - terms - array, with taxonomy names as keys and arrays of term IDs as values … … 776 781 777 782 stick_post( $post_ID ); 783 } 784 785 if ( isset ( $post_data['featured_image'] ) ) { 786 // empty value deletes, non-empty value adds/updates 787 if ( empty( $post_data['featured_image'] ) ) { 788 delete_post_thumbnail( $post_ID ); 789 } 790 else { 791 if ( set_post_thumbnail( $post_ID, $post_data['featured_image'] ) === false ) 792 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 793 } 794 unset( $content_struct['featured_image'] ); 778 795 } 779 796 … … 3330 3347 * - date_created_gmt 3331 3348 * - dateCreated 3349 * - wp_featured_image 3332 3350 * 3333 3351 * @since 1.5.0 … … 3576 3594 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 3577 3595 3596 if ( isset ( $post_data['wp_featured_image'] ) ) { 3597 if ( set_post_thumbnail( $post_ID, $post_data['wp_featured_image'] ) === false ) 3598 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 3599 3600 unset( $content_struct['wp_featured_image'] ); 3601 } 3602 3578 3603 // Handle enclosures 3579 3604 $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null; … … 3875 3900 if ( isset($content_struct['custom_fields']) ) 3876 3901 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 3902 3903 if ( isset ( $post_data['wp_featured_image'] ) ) { 3904 // empty value deletes, non-empty value adds/updates 3905 if ( empty( $post_data['wp_featured_image'] ) ) { 3906 delete_post_thumbnail( $post_ID ); 3907 } 3908 else { 3909 if ( set_post_thumbnail( $post_ID, $post_data['wp_featured_image'] ) === false ) 3910 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 3911 } 3912 unset( $content_struct['wp_featured_image'] ); 3913 } 3877 3914 3878 3915 // Handle enclosures … … 4012 4049 if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure; 4013 4050 4051 $resp['wp_featured_image'] = get_post_meta( $postdata['ID'], '_thumbnail_id', true ); 4052 $resp['wp_featured_image_url'] = wp_get_attachment_url( $resp['wp_featured_image'] ); 4053 4014 4054 return $resp; 4015 4055 } else { … … 4126 4166 ); 4127 4167 4168 $entry_index = count( $struct ) - 1; 4169 $struct[ $entry_index ][ 'wp_featured_image' ] = get_post_meta( $entry['ID'], '_thumbnail_id', true ); 4170 $struct[ $entry_index ][ 'wp_featured_image_url' ] = wp_get_attachment_url( $struct[ $entry_index ][ 'wp_featured_image' ] ); 4128 4171 } 4129 4172
Note: See TracChangeset
for help on using the changeset viewer.