WordPress.org

Make WordPress Core

Ticket #26042: revisions.php.patch

File revisions.php.patch, 891 bytes (added by nunomorgadinho, 6 years ago)
  • src/wp-includes/revision.php

     
    9191        // they are different, unless a plugin tells us to always save regardless.
    9292        // If no previous revisions, save one
    9393        if ( $revisions = wp_get_post_revisions( $post_id ) ) {
    94                 // grab the last revision, but not an autosave
    95                 foreach ( $revisions as $revision ) {
    96                         if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {
    97                                 $last_revision = $revision;
    98                                 break;
    99                         }
    100                 }
     94                // revisions are ordered so lets grab the last one
     95                $last_revision = array_pop($revisions);
    10196
    10297                if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) {
    10398                        $post_has_changed = false;