WordPress.org

Make WordPress Core

Ticket #22162: 22162.diff

File 22162.diff, 783 bytes (added by ryan, 18 months ago)

array_map if count changes

  • wp-includes/query.php

     
    27692769                        } 
    27702770                } 
    27712771 
    2772                 if ( !$q['suppress_filters'] ) 
     2772                $this->post_count = count( $this->posts ); 
     2773 
     2774                if ( ! $q['suppress_filters'] ) { 
    27732775                        $this->posts = apply_filters_ref_array('the_posts', array( $this->posts, &$this ) ); 
     2776                        $post_count = count( $this->posts ); 
     2777                        if ( $post_count != $this->post_count ) 
     2778                                $this->posts = array_map( 'get_post', $this->posts ); 
     2779                        $this->post_count = $post_count; 
     2780                } 
    27742781 
    2775                 $this->post_count = count( $this->posts ); 
    2776  
    27772782                // Always sanitize 
    27782783                foreach ( $this->posts as $i => $post ) { 
    27792784                        $this->posts[$i] = sanitize_post( $post, 'raw' );