Ticket #18812: rpc.diff
| File rpc.diff, 1.5 KB (added by , 14 years ago) |
|---|
-
wp-includes/class-wp-xmlrpc-server.php
2397 2397 // We've got all the data -- post it: 2398 2398 $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 2399 2400 $post_ID = wp_insert_post($postdata, true); 2400 // For published posts set it to an auto-draft first, to get a post id. 2401 // That gives us a chance to add the additional data to the post 2402 // before triggering a publish event. 2403 if ( $post_status == 'publish' ) { 2404 $postdata['post_status'] = 'auto-draft'; 2405 } 2406 2407 $post_ID = $postdata['ID'] = wp_insert_post($postdata, true); 2401 2408 if ( is_wp_error( $post_ID ) ) 2402 2409 return new IXR_Error(500, $post_ID->get_error_message()); 2403 2410 … … 2426 2433 if ( isset( $content_struct['wp_post_format'] ) ) 2427 2434 wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); 2428 2435 2436 // Make sure the proper status is set, for publishing that would 2437 // be from auto-draft to publish. 2438 $postdata['post_status'] = $post_status; 2439 $status = wp_update_post( $postdata, true ); 2440 2429 2441 logIO('O', "Posted ! ID: $post_ID"); 2430 2442 2431 2443 return strval($post_ID);