WordPress.org

Make WordPress Core

Ticket #11703: 11703.diff

File 11703.diff, 1.4 KB (added by dd32, 6 years ago)
  • wp-includes/post.php

     
    1515 * Creates the initial post types when 'init' action is fired. 
    1616 */ 
    1717function create_initial_post_types() { 
    18         register_post_type( 'post', array('exclude_from_search' => false) ); 
    19         register_post_type( 'page', array('exclude_from_search' => false) ); 
     18        register_post_type( 'post', array('exclude_from_search' => false, 'revisions' => true) ); 
     19        register_post_type( 'page', array('exclude_from_search' => false, 'revisions' => true) ); 
    2020        register_post_type( 'attachment', array('exclude_from_search' => false) ); 
    2121        register_post_type( 'revision', array('exclude_from_search' => true) ); 
    2222} 
     
    37283728        if ( !$post = get_post( $post_id, ARRAY_A ) ) 
    37293729                return; 
    37303730 
    3731         if ( !in_array( $post['post_type'], array( 'post', 'page' ) ) ) 
     3731        if ( !in_array( $post['post_type'], get_post_types( array('revisions' => true) ) ) ) 
    37323732                return; 
    37333733 
    37343734        $return = _wp_put_post_revision( $post ); 
     
    37403740        // all revisions and (possibly) one autosave 
    37413741        $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); 
    37423742 
    3743         // WP_POST_REVISIONS = (int) (# of autasaves to save) 
     3743        // WP_POST_REVISIONS = (int) (# of autosaves to save) 
    37443744        $delete = count($revisions) - WP_POST_REVISIONS; 
    37453745 
    37463746        if ( $delete < 1 )