Make WordPress Core

Ticket #47773: 47773.diff

File 47773.diff, 683 bytes (added by abhijitrakas, 6 years ago)

Add check for post status update failure

  • wp-includes/post.php

     
    30593059        add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status );
    30603060        add_post_meta( $post_id, '_wp_trash_meta_time', time() );
    30613061
    3062         wp_update_post(
     3062        $update_post_status = wp_update_post(
    30633063                array(
    30643064                        'ID'          => $post_id,
    30653065                        'post_status' => 'trash',
     
    30663066                )
    30673067        );
    30683068
     3069        // Check if post status not updated.
     3070        if ( is_wp_error( $update_post_status ) || 0 === $update_post_status ) {
     3071                return false;
     3072        }
     3073
    30693074        wp_trash_post_comments( $post_id );
    30703075
    30713076        /**