Posts, Post Types: Check the result of wp_update_post()
in wp_trash_post()
and wp_untrash_post()
.
Props abhijitrakas, manzoorwani.jk, siliconforks. Fixes #47773. git-svn-id: https://develop.svn.wordpress.org/trunk@45724 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3c73c7a56f
commit
a634252c15
@ -3059,13 +3059,17 @@ function wp_trash_post( $post_id = 0 ) {
|
|||||||
add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status );
|
add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status );
|
||||||
add_post_meta( $post_id, '_wp_trash_meta_time', time() );
|
add_post_meta( $post_id, '_wp_trash_meta_time', time() );
|
||||||
|
|
||||||
wp_update_post(
|
$post_updated = wp_update_post(
|
||||||
array(
|
array(
|
||||||
'ID' => $post_id,
|
'ID' => $post_id,
|
||||||
'post_status' => 'trash',
|
'post_status' => 'trash',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( ! $post_updated ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
wp_trash_post_comments( $post_id );
|
wp_trash_post_comments( $post_id );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3126,13 +3130,17 @@ function wp_untrash_post( $post_id = 0 ) {
|
|||||||
delete_post_meta( $post_id, '_wp_trash_meta_status' );
|
delete_post_meta( $post_id, '_wp_trash_meta_status' );
|
||||||
delete_post_meta( $post_id, '_wp_trash_meta_time' );
|
delete_post_meta( $post_id, '_wp_trash_meta_time' );
|
||||||
|
|
||||||
wp_update_post(
|
$post_updated = wp_update_post(
|
||||||
array(
|
array(
|
||||||
'ID' => $post_id,
|
'ID' => $post_id,
|
||||||
'post_status' => $post_status,
|
'post_status' => $post_status,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( ! $post_updated ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
wp_untrash_post_comments( $post_id );
|
wp_untrash_post_comments( $post_id );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user