WordPress.org

Make WordPress Core

Ticket #18822: 18822.alt.diff

File 18822.alt.diff, 833 bytes (added by scribu, 7 years ago)
  • wp-includes/query.php

    diff --git wp-includes/query.php wp-includes/query.php
    index f47a860a..c22136d 100644
    class WP_Query { 
    27452745
    27462746                $this->post_count = count($this->posts);
    27472747
    2748                 // Sanitize before caching so it'll only get done once
    2749                 for ( $i = 0; $i < $this->post_count; $i++ ) {
    2750                         $this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
    2751                 }
     2748                if ( $q['cache_results'] ) {
     2749                        // Sanitize before caching so it'll only get done once
     2750                        for ( $i = 0; $i < $this->post_count; $i++ ) {
     2751                                $this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
     2752                        }
    27522753
    2753                 if ( $q['cache_results'] )
    27542754                        update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
     2755                }
    27552756
    27562757                if ( $this->post_count > 0 ) {
    27572758                        $this->post = $this->posts[0];