Created
March 20, 2017 22:36
-
-
Save nigelheap/bc2f2e365cb665c3ebf167d80471c815 to your computer and use it in GitHub Desktop.
Wordpress: Prints debug info for the current request
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 | |
/** | |
* Prints debug info for the current request. | |
* Works well interest just after the opening <head> tag in your header template | |
*/ | |
function nigelheap_debug_request() { | |
global $wp, $template; | |
echo "\r\n"; | |
echo '<!– Request: '; | |
echo empty($wp->request) ? 'None' : esc_html($wp->request); | |
echo ' –>'."\r\n"; | |
echo '<!– Matched Rewrite Rule: '; | |
echo empty($wp->matched_rule) ? 'None' : esc_html($wp->matched_rule); | |
echo ' –>'."\r\n"; | |
echo '<!– Matched Rewrite Query: '; | |
echo empty($wp->matched_query) ? 'None' : esc_html($wp->matched_query); | |
echo ' –>'."\r\n"; | |
echo '<!– Loaded Template: '; | |
echo basename($template); | |
echo ' –>'."\r\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment