WordPress.org

Make WordPress Core

Ticket #24958: 24958.3.diff

File 24958.3.diff, 861 bytes (added by adamsilverstein, 5 years ago)
  • src/wp-includes/revision.php

     
    9898
    9999        // Compare the proposed update with the last stored revision verifying that
    100100        // they are different, unless a plugin tells us to always save regardless.
    101         // If no previous revisions, save one
    102         if ( $revisions = wp_get_post_revisions( $post_id ) ) {
     101        // Search back at most 100 revisions to find a non-autosave revision.
     102        // If no previous revisions, save one.
     103        if ( $revisions = wp_get_post_revisions( $post_id, array( 'posts_per_page' => 100 ) ) ) {
    103104                // grab the last revision, but not an autosave
    104105                foreach ( $revisions as $revision ) {
    105106                        if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {