Make WordPress Core

Ticket #18812: 18812.2.diff

File 18812.2.diff, 1.6 KB (added by josephscott, 13 years ago)
  • wp-includes/class-wp-xmlrpc-server.php

     
    23982398                        }
    23992399                }
    24002400
    2401                 // We've got all the data -- post it:
    24022401                $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');
    24032402
    2404                 $post_ID = wp_insert_post($postdata, true);
    2405                 if ( is_wp_error( $post_ID ) )
    2406                         return new IXR_Error(500, $post_ID->get_error_message());
     2403                $post_ID = $postdata['ID'] = get_default_post_to_edit( $post_type, true )->ID;
    24072404
    2408                 if ( !$post_ID )
    2409                         return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
    2410 
    24112405                // Only posts can be sticky
    24122406                if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
    24132407                        if ( $content_struct['sticky'] == true )
     
    24302424                if ( isset( $content_struct['wp_post_format'] ) )
    24312425                        wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' );
    24322426
     2427                $post_ID = wp_insert_post( $postdata, true );
     2428                if ( is_wp_error( $post_ID ) )
     2429                        return new IXR_Error(500, $post_ID->get_error_message());
     2430
     2431                if ( !$post_ID )
     2432                        return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
     2433
    24332434                logIO('O', "Posted ! ID: $post_ID");
    24342435
    24352436                return strval($post_ID);