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

git-svn-id: http://svn.automattic.com/wordpress/trunk@11880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-08-26 04:57:29 +00:00
parent 83161b0695
commit 40771b0bf4
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);