get query’s query string

By the time index.php runs, it seems as though there is already a query populated.

How can I find out what that query’s query string is?

Read More

eg. new WP_Query([query string is here])

Related posts

Leave a Reply

2 comments

  1. <?php var_dump( $GLOBALS['wp_query'] ); ?>
    

    and if you have custom loop in your template, dont forget to use (query_post()) <?php wp_reset_query(); ?> or (new WP_Query) <?php wp_reset_postdata(); ?>
    🙂

    Function should be called after The Loop to ensure conditional tags work as expected.