WordPress.org

Make WordPress Core

Changeset 22584


Ignore:
Timestamp:
11/14/12 22:58:24 (17 months ago)
Author:
westi
Message:

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.

File:
1 edited

Legend:

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

    r22560 r22584  
    12141214        $post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct ); 
    12151215 
    1216         $post_ID = wp_insert_post( $post_data, true ); 
     1216        $post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true ); 
    12171217        if ( is_wp_error( $post_ID ) ) 
    12181218            return new IXR_Error( 500, $post_ID->get_error_message() ); 
Note: See TracChangeset for help on using the changeset viewer.