WordPress.org

Make WordPress Core

Changeset 11880


Ignore:
Timestamp:
08/26/2009 04:57:29 AM (9 years ago)
Author:
azaozz
Message:

Fix returning to the previous post_status when restoring posts from the trash, see #4529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r11878 r11880  
    12581258    do_action('untrash_post', $post_id);
    12591259
    1260     $post['post_status'] = ('attachment' == $post['post_type'] ) ? 'inherit' : 'draft';
    1261 
    1262     delete_post_meta($post_id,'_wp_trash_meta_status');
    1263     delete_post_meta($post_id,'_wp_trash_meta_time');
     1260    $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
     1261    if ( empty($post_status) )
     1262        $post_status = ('attachment' == $post['post_type'] ) ? 'inherit' : 'draft';
     1263
     1264    $post['post_status'] = $post_status;
     1265
     1266    delete_post_meta($post_id, '_wp_trash_meta_status');
     1267    delete_post_meta($post_id, '_wp_trash_meta_time');
    12641268
    12651269    wp_insert_post($post);
Note: See TracChangeset for help on using the changeset viewer.