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


git-svn-id: https://develop.svn.wordpress.org/trunk@22277 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2012-10-23 14:08:20 +00:00
parent abd1718828
commit abda77ed10
1 changed files with 3 additions and 2 deletions

View File

@ -1099,8 +1099,9 @@ class wp_xmlrpc_server extends IXR_Server {
// empty value deletes, non-empty value adds/updates // empty value deletes, non-empty value adds/updates
if ( ! $post_data['post_thumbnail'] ) if ( ! $post_data['post_thumbnail'] )
delete_post_thumbnail( $post_ID ); delete_post_thumbnail( $post_ID );
elseif ( ! set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) ) elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) )
return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] );
unset( $content_struct['post_thumbnail'] ); unset( $content_struct['post_thumbnail'] );
} }