I've been really wondering about the following:
Wordpress matches every request with a rewrite rule and sets the query vars associated with the rule. Later on, these vars are used to construct a db query which will return the posts/items to display in THE loop.
Is there ANY way to tell wordpress that the present request does not need post data from the database because a plugin "got it covered"?
I'm programming a plugin that provides a rather large form. I created custom rewrite rules, registered add'l query_vars, hooked into the init action and the rewrite filter, but wordpress pulls posts from the db because I could not find a way to prevent this.
- I created the custom rewrite rule
^/myplugin/form1/?$and mapped it to
- Then, I hook into the
initaction in which I add the query_var
myplugin(see rewrite rule)
- In addition, I hook into the
rewritefilter. That way I can determine whether the present request has the
mypluginvariable (if so, I do something).
- From here, there seems to be no way to stop any further processing by wordpress. WordPress always makes its four to seven db queries which are a waste in this case.