WordPress.org

Make WordPress Core

Ticket #22162: 22162.3.diff

File 22162.3.diff, 699 bytes (added by ryan, 2 years ago)

Replace sanitize loop with get_post array_map

  • wp-includes/query.php

     
    27742774 
    27752775                $this->post_count = count( $this->posts ); 
    27762776 
    2777                 // Always sanitize 
    2778                 foreach ( $this->posts as $i => $post ) { 
    2779                         $this->posts[$i] = sanitize_post( $post, 'raw' ); 
    2780                 } 
     2777                // Ensure that any posts added/modified via one of the filters above are 
     2778                // of the type WP_Post and are filtered. 
     2779                $this->posts = array_map( 'get_post', $this->posts ); 
    27812780 
    27822781                if ( $q['cache_results'] ) 
    27832782                        update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);