WordPress.org

Make WordPress Core

Ticket #12611: 12611.diff

File 12611.diff, 838 bytes (added by ryan, 5 years ago)
  • wp-includes/query.php

     
    15971597         * @return array List of posts. 
    15981598         */ 
    15991599        function &get_posts() { 
    1600                 global $wpdb, $user_ID; 
     1600                global $wpdb, $user_ID, $_wp_using_ext_object_cache; 
    16011601 
    16021602                do_action_ref_array('pre_get_posts', array(&$this)); 
    16031603 
     
    25072507                        $this->posts[$i] = sanitize_post($this->posts[$i], 'raw'); 
    25082508                } 
    25092509 
     2510                // If using an object cache and the number of posts is greater than 20, skip updating the post caches. 
     2511                if ( $_wp_using_ext_object_cache && $this->post_count > apply_filters('update_post_cache_threshold', 20) ) 
     2512                        $q['cache_results'] = false; 
     2513 
    25102514                if ( $q['cache_results'] ) 
    25112515                        update_post_caches($this->posts, $post_type); 
    25122516