WordPress.org

Make WordPress Core

Changeset 22277


Ignore:
Timestamp:
10/23/2012 02:08:20 PM (6 years ago)
Author:
ryan
Message:

In wp_xmlrpc_server::_insert_post(), don't return an error if set_post_thumbnail() returns false when the attachment ID doesn't change.

Props picklepete
fixes #22204

File:
1 edited

Legend:

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

    r22171 r22277  
    11001100            if ( ! $post_data['post_thumbnail'] )
    11011101                delete_post_thumbnail( $post_ID );
    1102             elseif ( ! set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) )
    1103                     return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
     1102            elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) )
     1103                return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
     1104            set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] );
    11041105            unset( $content_struct['post_thumbnail'] );
    11051106        }
Note: See TracChangeset for help on using the changeset viewer.