[buddypress-trac] [BuddyPress] #967: unnecessary extra query caused by bp_dtheme_show_home_blog

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Fri Oct 2 19:20:38 UTC 2009


#967: unnecessary extra query caused by bp_dtheme_show_home_blog
------------------------------+---------------------------------------------
Reporter:  junsuijin          |       Owner:  junsuijin
    Type:  defect             |      Status:  new      
Priority:  major              |   Milestone:  1.2      
Keywords:  has-patch, tested  |  
------------------------------+---------------------------------------------

Comment(by junsuijin):

 Just updated the WP ticket, the new method saves more time, but as
 mentioned in the WP ticket, adds extra queries (likely due to a lack of
 caching), when site-wide posts are queried. This is easy enough to prevent
 in case end users want to include those kinds of widgets on BuddyPress
 pages that don't already have them. The updated means of applying this fix
 should work as follows (note that this method can also save queries on the
 /blog page but this particular invocation will not cause that to happen):
 {{{
 function bp_no_wp_main() {
         if ( ! bp_is_blog_page() && ! bp_is_user_recent_posts() )
                 add_filter( 'wp_main', 'bp_set_no_wp_main' );
 }
 add_action( 'init', 'bp_no_wp_main', 0 );

         function bp_set_no_wp_main() {
                 return false;
         }
 }}}

-- 
Ticket URL: <http://trac.buddypress.org/ticket/967#comment:4>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list