| 1 | Index: wp-includes/class-wp-xmlrpc-server.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/class-wp-xmlrpc-server.php (revision 40705) |
|---|
| 4 | +++ wp-includes/class-wp-xmlrpc-server.php (working copy) |
|---|
| 5 | @@ -2398,16 +2398,10 @@ |
|---|
| 6 | } |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | - // We've got all the data -- post it: |
|---|
| 10 | $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template'); |
|---|
| 11 | |
|---|
| 12 | - $post_ID = wp_insert_post($postdata, true); |
|---|
| 13 | - if ( is_wp_error( $post_ID ) ) |
|---|
| 14 | - return new IXR_Error(500, $post_ID->get_error_message()); |
|---|
| 15 | + $post_ID = $postdata['ID'] = get_default_post_to_edit( $post_type, true )->ID; |
|---|
| 16 | |
|---|
| 17 | - if ( !$post_ID ) |
|---|
| 18 | - return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); |
|---|
| 19 | - |
|---|
| 20 | // Only posts can be sticky |
|---|
| 21 | if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { |
|---|
| 22 | if ( $content_struct['sticky'] == true ) |
|---|
| 23 | @@ -2430,6 +2424,13 @@ |
|---|
| 24 | if ( isset( $content_struct['wp_post_format'] ) ) |
|---|
| 25 | wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); |
|---|
| 26 | |
|---|
| 27 | + $post_ID = wp_insert_post( $postdata, true ); |
|---|
| 28 | + if ( is_wp_error( $post_ID ) ) |
|---|
| 29 | + return new IXR_Error(500, $post_ID->get_error_message()); |
|---|
| 30 | + |
|---|
| 31 | + if ( !$post_ID ) |
|---|
| 32 | + return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); |
|---|
| 33 | + |
|---|
| 34 | logIO('O', "Posted ! ID: $post_ID"); |
|---|
| 35 | |
|---|
| 36 | return strval($post_ID); |
|---|