XMLRPC: When Editing an existing post make sure to use wp_update_post instead of wp_insert_post so as to not perform destructive actions on the content.
The wp.EditPost() API will accept very limited data to only edit specific attributes of a post, if you didn't supply a category change then we would previously overwrite the original categories with the default cat. Fixes #22220 props nacin. git-svn-id: http://core.svn.wordpress.org/trunk@22584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
511c14e4ed
commit
fe99b07017
|
@ -1213,7 +1213,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
|
||||
$post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct );
|
||||
|
||||
$post_ID = wp_insert_post( $post_data, true );
|
||||
$post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true );
|
||||
if ( is_wp_error( $post_ID ) )
|
||||
return new IXR_Error( 500, $post_ID->get_error_message() );
|
||||
|
||||
|
|
Loading…
Reference in New Issue