WordPress.org

Make WordPress Core

Ticket #18812: wp-18812.diff

File wp-18812.diff, 1.1 KB (added by koke, 3 years ago)

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

  • wp-includes/class-wp-xmlrpc-server.php

     
    23962396 
    23972397                // We've got all the data -- post it: 
    23982398                $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'); 
     2399                if ( $post_status == 'publish' ) { 
     2400                        $postdata['post_status'] = 'auto-draft'; 
     2401                } 
    23992402 
    24002403                $post_ID = wp_insert_post($postdata, true); 
    24012404                if ( is_wp_error( $post_ID ) ) 
     
    24252428                // in this function 
    24262429                if ( isset( $content_struct['wp_post_format'] ) ) 
    24272430                        wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); 
     2431                 
     2432                $postdata['post_status'] = $post_status; 
     2433                wp_update_post( $postdata, true ); 
    24282434 
    24292435                logIO('O', "Posted ! ID: $post_ID"); 
    24302436