Make WordPress Core

Ticket #14426: 14426.patch

File 14426.patch, 981 bytes (added by SergeyBiryukov, 13 years ago)
  • wp-includes/query.php

     
    26422642                        $ids = $wpdb->get_col( $this->request );
    26432643
    26442644                        if ( $ids ) {
     2645                                $this->posts = $ids;
    26452646                                $this->set_found_posts( $q, $limits );
    26462647                                _prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
    2647                                 $this->posts = $ids;
    26482648                        } else {
    26492649                                $this->posts = array();
    2650                                 $this->found_posts = $this->max_num_pages = 0;
    26512650                        }
    26522651                } else {
    26532652                        $this->posts = $wpdb->get_results( $this->request );
     
    27702769        function set_found_posts( $q, $limits ) {
    27712770                global $wpdb;
    27722771
    2773                 if ( $q['no_found_rows'] || empty( $limits ) )
     2772                if ( $q['no_found_rows'] || empty( $limits ) || ! $this->posts )
    27742773                        return;
    27752774
    27762775                $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );