Ticket #7237: 7237.diff

File 7237.diff, 1.4 KB (added by mdawaffe, 5 years ago)
  • wp-includes/post.php

     
    12181218        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, 
    12191219                'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 
    12201220                'menu_order' => 0, 'to_ping' =>  '', 'pinged' => '', 'post_password' => '', 
    1221                 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => ''); 
     1221                'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'clean_cache' => true ); 
    12221222 
    12231223        $postarr = wp_parse_args($postarr, $defaults); 
    12241224        $postarr = sanitize_post($postarr, 'db'); 
     
    13811381 
    13821382        $current_guid = get_post_field( 'guid', $post_ID ); 
    13831383 
    1384         if ( 'page' == $post_type ) 
    1385                 clean_page_cache($post_ID); 
    1386         else 
    1387                 clean_post_cache($post_ID); 
     1384        if ( $clean_cache ) { 
     1385                if ( 'page' == $post_type ) 
     1386                        clean_page_cache($post_ID); 
     1387                else 
     1388                        clean_post_cache($post_ID); 
     1389        } 
    13881390 
    13891391        // Set GUID 
    13901392        if ( !$update && '' == $current_guid ) 
     
    32973299        if ( isset($post['post_type']) && 'revision' == $post_post['type'] ) 
    32983300                return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); 
    32993301 
     3302        // In current implemenation, we're always inserting a new row without taxonomy or meta 
     3303        $post['clean_cache'] = false; 
    33003304        $post = _wp_post_revision_fields( $post, $autosave ); 
    33013305 
    33023306        $revision_id = wp_insert_post( $post );