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

git-svn-id: https://develop.svn.wordpress.org/trunk@11880 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-08-26 04:57:29 +00:00
parent 6db1862bd7
commit 69cac32a8f
1 changed files with 7 additions and 3 deletions

View File

@ -1257,10 +1257,14 @@ function wp_untrash_post($post_id = 0) {
do_action('untrash_post', $post_id);
$post['post_status'] = ('attachment' == $post['post_type'] ) ? 'inherit' : 'draft';
$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
if ( empty($post_status) )
$post_status = ('attachment' == $post['post_type'] ) ? 'inherit' : 'draft';
delete_post_meta($post_id,'_wp_trash_meta_status');
delete_post_meta($post_id,'_wp_trash_meta_time');
$post['post_status'] = $post_status;
delete_post_meta($post_id, '_wp_trash_meta_status');
delete_post_meta($post_id, '_wp_trash_meta_time');
wp_insert_post($post);