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.
Built from https://develop.svn.wordpress.org/trunk@45724


git-svn-id: http://core.svn.wordpress.org/trunk@45535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-08-03 03:47:54 +00:00
parent c26f1c5d90
commit 76f482de43
2 changed files with 11 additions and 3 deletions

View File

@ -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_time', time() );
wp_update_post(
$post_updated = wp_update_post(
array(
'ID' => $post_id,
'post_status' => 'trash',
)
);
if ( ! $post_updated ) {
return false;
}
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_time' );
wp_update_post(
$post_updated = wp_update_post(
array(
'ID' => $post_id,
'post_status' => $post_status,
)
);
if ( ! $post_updated ) {
return false;
}
wp_untrash_post_comments( $post_id );
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45723';
$wp_version = '5.3-alpha-45724';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.