[wp-trac] [WordPress Trac] #18879: Impossible to use wp_admin_bar_class filter

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 10 08:28:39 UTC 2011


#18879: Impossible to use wp_admin_bar_class filter
-----------------------------------------+------------------------------
 Reporter:  geminorum                    |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  General                      |     Version:  3.2.1
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+------------------------------
Changes (by kawauso):

 * keywords:  has-patch => has-patch reporter-feedback


Comment:

 There is no need to require class-wp-admin-bar.php a second time. If
 you're extending it, then it's already loaded by the time the
 'wp_admin_bar_class' filter is fired.

 Test code:

 {{{
 <?php
 function check_wp_admin_bar_class( $class ) {
         class My_Admin_Bar extends WP_Admin_Bar {

         }

         echo '<p>&nbsp;</p><p><pre>'; var_dump( class_exists(
 'My_Admin_Bar' ) ); echo '</pre></p>';
         return 'My_Admin_Bar';
 }

 add_action( 'wp_admin_bar_class', 'check_wp_admin_bar_class' );
 }}}

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


More information about the wp-trac mailing list