Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working with the admin bar and trying to debug some of the menus and their priorities.

I know several callbacks get bound to actions, such as this one:

add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );

How can I see what is lined up to be called when a hook like admin_bar_menu is called?

share|improve this question
    
Hook onto the shutdown action and print the $wp_filters global or similar? .. not got a working WP install right now to say in absolution... (but i know there's a global with filters and/or actions).. just a pointer.. ;) –  t31os Nov 29 '11 at 22:56
    
awesome - just it needs to be singular $wp_filter –  cwd Nov 30 '11 at 4:02

1 Answer 1

up vote 3 down vote accepted

You can see the detailed list of the hook using this snippet:

$hook_name = 'admin_bar_menu';
global $wp_filter;
var_dump( $wp_filter[$hook_name] );
share|improve this answer
    
almost right. needs to be $wp_filter singular. thanks. –  cwd Nov 30 '11 at 4:02
    
Right, answer updated. –  Rilwis Dec 1 '11 at 3:56
    
Is there an easy place that this can be placed so that it can be tested? I realize that this is pretty old, but anyone? –  derickito Jan 31 '13 at 23:55
    
You can put it in header or footer, using wp_head, wp_footer or shutdown hook. Note: if you don't want users to see this debug information, you should check user permission by if ( current_user_can( 'manage_options' ) ) {...} –  Rilwis Feb 1 '13 at 2:03
    
I use some functions to format it more nicely. Useful if you use it often for debugging and want to see the info quicker. Here is a gist. –  J.D. Jun 6 at 15:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.