The ‘all’ hook

While checking links from Lance Willett‘s WordCamp San Diego talk, found reference to post by Nacin “5 Ways to Debug WordPress“, that I read while ago, where Nacin suggests using ‘all’ and ‘shutdown’ hooks for debugging. Found those methods very hand, especially ‘all’ hook, which fires for every action and filter and to quote Nacin:

You’ll be surprised how many hooks get executed on every page load. Good for troubleshooting and identifying the right hook.

Here’s code snippet you can put somewhere in you development/debugging plugin.

add_action( 'all', create_function( '', 'var_dump( current_filter() );' ) );

Lance’s talk from WordCamp San Diego – Theme Busters R Us

About these ads

Published by

George

Hello, I'm George Mamadashvili ( aka Mamaduka ), WordPress Developer from Tbilisi, Georgia.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s