Revisions: Update _edit_last when restoring a post.

props redpixelstudios. fixes #20982.

git-svn-id: http://core.svn.wordpress.org/trunk@24178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2013-05-06 09:49:13 +00:00
parent b7a6638428
commit 5862f837a2

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;
}