WordPress.org

Make WordPress Core

Changeset 24178


Ignore:
Timestamp:
05/06/2013 09:49:13 AM (5 years ago)
Author:
ocean90
Message:

Revisions: Update _edit_last when restoring a post.

props redpixelstudios. fixes #20982.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/revision.php

    r24177 r24178  
    373373
    374374    $post_id = wp_update_post( $update );
    375     if ( is_wp_error( $post_id ) )
     375    if ( ! $post_id || is_wp_error( $post_id ) )
    376376        return $post_id;
    377377
    378     if ( $post_id )
    379         do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
    380 
     378    // Add restore from details
    381379    $restore_details = array(
    382380        'restored_revision_id' => $revision_id,
    383         'restored_by_user' => get_current_user_id(),
    384         'restored_time' => time()
     381        'restored_by_user'     => get_current_user_id(),
     382        'restored_time'        => time()
    385383    );
    386384    update_post_meta( $post_id, '_post_restored_from', $restore_details );
     385
     386    // Update last edit user
     387    update_post_meta( $post_id, '_edit_last', get_current_user_id() );
     388
     389    do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
    387390
    388391    return $post_id;
Note: See TracChangeset for help on using the changeset viewer.