WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 0 down vote accepted

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 );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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