[wp-trac] [WordPress Trac] #20101: Can't use 'show_admin_bar' filter with conditional tags

WordPress Trac wp-trac at lists.automattic.com
Wed Feb 22 19:10:11 UTC 2012


#20101: Can't use 'show_admin_bar' filter with conditional tags
--------------------------+-----------------------------
 Reporter:  scribu        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I'm trying to show the admin bar only on the front page:

 {{{
 function scribu_show_admin_bar() {
   return is_front_page();
 }

 add_filter( 'show_admin_bar', 'scribu_show_admin_bar' );
 }}}

 However, this doesn't work because '_wp_admin_bar_init' is called on
 'init', before the main WP_Query is set up.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20101>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list