#18879 closed defect (bug) (invalid)
Impossible to use wp_admin_bar_class filter
Reported by: | geminorum | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.2.1 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
wanting to extend WP_Admin_Bar class, cannot include the class-wp-admin-bar.php for a fatal (cannot redeclare class). because of require() instead of require_once() on _wp_admin_bar_init()
Attachments (1)
Change History (8)
#4
@
13 years ago
- Keywords reporter-feedback added
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> </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' );
Note: See
TracTickets for help on using
tickets.
Seems like a valid bug. I'll get a patch for it.