WordPress.org

Make WordPress Core

Ticket #17066: 17066.diff

File 17066.diff, 1.2 KB (added by solarissmoke, 3 years ago)
  • wp-includes/query.php

     
    26302630                        $this->comment_count = count($this->comments); 
    26312631                } 
    26322632 
    2633                 if ( !$q['no_found_rows'] && !empty($limits) ) { 
    2634                         $found_posts_query = apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ); 
    2635                         $this->found_posts = $wpdb->get_var( $found_posts_query ); 
    2636                         $this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) ); 
    2637                         $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); 
     2633                if ( ! $q['no_found_rows'] ) { 
     2634                        if ( empty( $limits ) ) { 
     2635                                $this->found_posts = count( $this->posts ); 
     2636                        } 
     2637                        else { 
     2638                                $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()', $this ); 
     2639                                $this->found_posts = $wpdb->get_var( $found_posts_query ); 
     2640                        } 
     2641                        $this->found_posts = apply_filters( 'found_posts', $this->found_posts, $this ); 
     2642                        $this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] ); 
    26382643                } 
    26392644 
    26402645                // Check post status to determine if post should be displayed.