How to inspect global variables in WordPress

Posted by Prem Tiwari | Updated on

Use this to get an insight view of what you can use from the current request/wp_query.


// If you’re looking at other variables you might need to use different hooks
// this can sometimes be a little tricky.
// Take a look at the Action Reference:
add_action( ‘shutdown’, ‘inspect_wp_query’, 999 ); // Query on public facing pages
add_action( ‘admin_footer’, ‘inspect_wp_query’, 999 ); // Query in admin UI

How to actually get the data:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers