It it possible to get the configuration of a the latest called WP_Query? I need to use it for debugging.

For example, if i run something like:

$the_query = new WP_Query( $args );

Could i get the $args array later by doing something like $the_query->args(); or something?

1 Answer 1


Try the $query_vars property:

$the_query = new WP_Query( $args );

$query_arguments = $the_query->query_vars;

Which should return an associative array of query variables. To test:

var_dump( $query_arguments );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.