Created
December 23, 2014 17:44
-
-
Save albb0920/c87a8ebc595def9c8e0a to your computer and use it in GitHub Desktop.
Wordpress debug snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$hooks = array(); | |
add_action('all', function($hook){ | |
global $hooks; | |
$hooks[]= $hook; | |
}); | |
add_action('admin_print_scripts', function(){ | |
global $hooks; | |
echo "<script>console.log('hooks:'); console.log('".implode(',',array_unique($hooks))."');</script>"; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define ('SAVEQUERIES', true); | |
add_action('admin_print_scripts', function(){ | |
global $wpdb; | |
echo "<script>console.log(". json_encode($wpdb->queries).");</script>"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment