{"id":800,"date":"2012-05-25T09:24:51","date_gmt":"2012-05-25T19:24:51","guid":{"rendered":"http:\/\/mymonkeydo.com\/?p=800"},"modified":"2012-05-25T09:24:51","modified_gmt":"2012-05-25T19:24:51","slug":"wordpress-debugging","status":"publish","type":"post","link":"https:\/\/mymonkeydo.com\/wordpress-debugging\/","title":{"rendered":"WordPress debugging"},"content":{"rendered":"
Some useful tips for debugging wordpress will be listed here for future reference.<\/p>\n
If you need to display all hooks, use the command below. \u00a0It is useful when trying to find a hook to alter some part of wordpress.<\/p>\n
add_action( 'all', create_function( '', 'var_dump( current_filter() ); ' ) );<\/pre>\nDisplay all for a Specific Hook<\/h2>\n
use the following code:<\/p>\n
global $wp_filter;\nprint_r($wp_filter[$hook_name]);<\/pre>\nDisplay Queries<\/h2>\n
To display any queries run by wordpress you can set SAVEQUERIES to be true and then print out the queries.<\/p>\n
define( 'SAVEQUERIES', true );<\/pre>\nThen place the following right after your query:<\/p>\n
var_dump($wpdb->queries);exit;<\/pre>\n<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[2],"tags":[18,54,64],"yoast_head":"\n
Wordpress debugging - My Monkey Do<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n