WordPress.org

Make WordPress Core

Ticket #10480: edit_result.diff

File edit_result.diff, 1.5 KB (added by sirzooro, 6 years ago)

1st attempt

  • wp-admin/admin-ajax.php

    old new  
    10951095                $data['ping_status'] = 'closed'; 
    10961096 
    10971097        // update the post 
    1098         edit_post(); 
     1098        $result = edit_post(); 
     1099        if ( is_wp_error( $result ) ) { 
     1100                print $result->get_error_message(); 
     1101                die(); 
     1102        } 
    10991103 
    11001104        $post = array(); 
    11011105        if ( 'page' == $_POST['post_type'] ) { 
  • wp-admin/includes/post.php

    old new  
    189189 
    190190        add_meta( $post_ID ); 
    191191 
    192         wp_update_post( $post_data ); 
     192        $result = wp_update_post( $post_data ); 
     193        if ( is_wp_error( $result ) ) 
     194                return $result; 
    193195 
    194196        // Reunite any orphaned attachments with their parent 
    195197        if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) 
  • wp-includes/post.php

    old new  
    15181518        // expected_slashed (everything!) 
    15191519        $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) ); 
    15201520        $data = apply_filters('wp_insert_post_data', $data, $postarr); 
     1521        if ( is_wp_error( $data ) ) 
     1522                return $data; 
    15211523        $data = stripslashes_deep( $data ); 
    15221524        $where = array( 'ID' => $post_ID ); 
    15231525