Ticket #18812: wp-18812.diff

File wp-18812.diff, 1.1 KB (added by koke, 20 months ago)

Patch to set 'auto-draft' on metaWeblog.newPost until the post is complete

Line 
1Index: wp-includes/class-wp-xmlrpc-server.php
2===================================================================
3--- wp-includes/class-wp-xmlrpc-server.php      (revision 18813)
4+++ wp-includes/class-wp-xmlrpc-server.php      (working copy)
5@@ -2396,6 +2396,9 @@
6 
7                // We've got all the data -- post it:
8                $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');
9+               if ( $post_status == 'publish' ) {
10+                       $postdata['post_status'] = 'auto-draft';
11+               }
12 
13                $post_ID = wp_insert_post($postdata, true);
14                if ( is_wp_error( $post_ID ) )
15@@ -2425,6 +2428,9 @@
16                // in this function
17                if ( isset( $content_struct['wp_post_format'] ) )
18                        wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' );
19+               
20+               $postdata['post_status'] = $post_status;
21+               wp_update_post( $postdata, true );
22 
23                logIO('O', "Posted ! ID: $post_ID");
24