• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

WordPress debugging

May 25, 2012 by Webhead

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;
print_r($wp_filter[$hook_name]);

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:

var_dump($wpdb->queries);exit;

 

Filed Under: Coding Tagged With: debug, php, wordpress

Primary Sidebar

Topics

apache apple bootstrap buddypress chrome cloudways cms css debug drupal eCommerce firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery kinsta linux localization mac os x ms sql mysql open source optimize php php 7.2 svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools
  • Uncategorized