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?
Leave a Reply
You must be logged in to post a comment.
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.
request
is only applied once, byparse_request()
, a method of theWP
class. There is only one reference to this, it is by another method ofWP
,main()
.main()
is referenced one time, bywp()
.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()
, andwp_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 callquery_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.