Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

As stated in one of the answers in this question and in the codex entry for the request filter, said filter gets called only in a default query, such as the main query used for a loop. My question is, what else is or isn't considered a default query? Would creating a new WP_Query object be considered such?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The "default" query is the one WordPress does itself, based on the URL and such, automatically.

Any query you create manually, via a new WP_Query or by calling query_posts(), will not use the 'request' filter.

There is only one "default" query, and you cannot trigger it via any code in the template.

share|improve this answer
    
Just needed some clarification. Thanks for the answer, Otto man. –  Manny Fleurmond Feb 15 '12 at 1:34
add comment

request is only applied once, by parse_request(), a method of the WP class. There is only one reference to this, it is by another method of WP, main(). main() is referenced one time, by wp(). wp() is referenced in a few different contexts by a number of different functions and files: wp_trackback.php, get_feed(), wp-blog-header.php, wp_edit_posts_query(), and wp_edit_attachments_query(). So, looking through that, nothing that `WP_Query calls is listed.

Short answer: I'd say no, it does not call request.

All that said, my work is based on working backwards with phpxref (hence the links), so I may have missed something, or it may have missed something. A better way to ask your question might be to ask on what you're trying to do, not on your implementation of it.

Just a note: main() does call query_posts(), which (I think) does the default query and such, but an instance of WP_Query alone shouldn't be enough to trigger this from what I've seen.

share|improve this answer
add comment

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.