mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
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:
parent
b7a6638428
commit
5862f837a2
@ -372,19 +372,22 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
|
|||||||
set_post_format( $update['ID'], get_post_meta( $revision['ID'], '_revision_post_format', true ) );
|
set_post_format( $update['ID'], get_post_meta( $revision['ID'], '_revision_post_format', true ) );
|
||||||
|
|
||||||
$post_id = wp_update_post( $update );
|
$post_id = wp_update_post( $update );
|
||||||
if ( is_wp_error( $post_id ) )
|
if ( ! $post_id || is_wp_error( $post_id ) )
|
||||||
return $post_id;
|
return $post_id;
|
||||||
|
|
||||||
if ( $post_id )
|
// Add restore from details
|
||||||
do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
|
|
||||||
|
|
||||||
$restore_details = array(
|
$restore_details = array(
|
||||||
'restored_revision_id' => $revision_id,
|
'restored_revision_id' => $revision_id,
|
||||||
'restored_by_user' => get_current_user_id(),
|
'restored_by_user' => get_current_user_id(),
|
||||||
'restored_time' => time()
|
'restored_time' => time()
|
||||||
);
|
);
|
||||||
update_post_meta( $post_id, '_post_restored_from', $restore_details );
|
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;
|
return $post_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user