WordPress debugging

Some useful tips for debugging wordpress will be listed here for future reference.

Display All Hooks

If you need to display all hooks, use the command below.  It is useful when trying to find a hook to alter some part of wordpress.

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

Display all for a Specific Hook

use the following code:

global $wp_filter;

Display Queries

To display any queries run by wordpress you can set SAVEQUERIES to be true and then print out the queries.

define( 'SAVEQUERIES', true );

Then place the following right after your query:



Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *