Revisions: Update _edit_last when restoring a post.

props redpixelstudios. fixes #20982.

git-svn-id: https://develop.svn.wordpress.org/trunk@24178 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2013-05-06 09:49:13 +00:00
parent 47865a91ce
commit 803ea2541e

View File

@ -372,12 +372,10 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
set_post_format( $update['ID'], get_post_meta( $revision['ID'], '_revision_post_format', true ) );
$post_id = wp_update_post( $update );
if ( is_wp_error( $post_id ) )
if ( ! $post_id || is_wp_error( $post_id ) )
return $post_id;
if ( $post_id )
do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
// Add restore from details
$restore_details = array(
'restored_revision_id' => $revision_id,
'restored_by_user' => get_current_user_id(),
@ -385,6 +383,11 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
);
update_post_meta( $post_id, '_post_restored_from', $restore_details );
// Update last edit user
update_post_meta( $post_id, '_edit_last', get_current_user_id() );
do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
return $post_id;
}