How to retrieve current page WP_Query arguments?

Context

I’m developping a plugin showing geolocated posts on a leaflet map. I want to add a shortcode parameter to show a map with only the current loop posts’ markers. That feature would be great on the search result page for exemple!

Question

Is there a way to get the current page WP_Query arguments? I want to get those arguments to create a new WP_Query and add some more to filter only geolocated posts.

I don’t know if it’s possible at all, I always create new WP_query objects from scratch.

Thank you!

3 Answers
3

Have you tried using $wp_query ?

global $wp_query;
var_dump($wp_query->query_vars);

For a single variable, you can use get_query_var

Or you could try just dumping the $_POST , var_dump( $_POST );

Or maybe var_dump( $GLOBALS['post'] );

Leave a Comment