Created
April 26, 2016 00:29
-
-
Save pingram3541/48c4d138f03266181537a0336da80cfc to your computer and use it in GitHub Desktop.
Display last query using ?show_query=true
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 | |
/******************************************************************* | |
* as seen on - https://www.youtube.com/watch?v=oWXjVUcPSPk | |
* by: Tom McFarlin | |
********************/ | |
add_filter( 'posts_request', 'my_show_query' ); | |
function my_show_query( $query ){ | |
if ( isset( $_GET['show_query'] ) && 'true' === $_GET['show_query'] ) { | |
var_dump( $query ); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment