Skip to content

Instantly share code, notes, and snippets.

@coderaaron
Created February 3, 2017 22:03
Show Gist options
  • Save coderaaron/d2f629f2f91d7b86cf9188df38148cec to your computer and use it in GitHub Desktop.
Save coderaaron/d2f629f2f91d7b86cf9188df38148cec to your computer and use it in GitHub Desktop.
How to get a custom WP_Query in the global $post
global $ppi_query;
...
$ppi_query = new WP_Query( $args );
...
global $ppi_query;
global $post;
if ( $ppi_query ==null ) { $ppi_query = $wp_query; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment