[wp-trac] [WordPress Trac] #14426: unneeded "SELECT FOUND_ROWS()" when no posts are found

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 27 21:38:55 UTC 2010


#14426: unneeded "SELECT FOUND_ROWS()" when no posts are found
--------------------------+-------------------------------------------------
 Reporter:  mark-k        |       Owner:     
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  3.1
Component:  Optimization  |     Version:  3.0
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------

Comment(by mark-k):

 Replying to [comment:3 Denis-de-Bernardy]:
 > Doesn't that filter allows to redo the query using a plugin?

 If that is the purpose then why is it depended on $limit being non zero?
 Even if it is, then the proposed code should probably be

 {{{
                 if ( !empty($limits) ) {
                    $found_posts_query = apply_filters(
 'found_posts_query', 'SELECT FOUND_ROWS()' );
                    if (!empty($this->posts) || ($found_posts_query !=
 'SELECT FOUND_ROWS()')
                         $this->found_posts = $wpdb->get_var(
 $found_posts_query );
                    else
                        $this->found_posts = 0;

 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14426#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list