Support » Plugins » Prevent the usual database queries?

  • Hi all:
    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 index.php?myplugin=form1
    • Then, I hook into the init action in which I add the query_var myplugin (see rewrite rule)
    • In addition, I hook into the rewrite filter. That way I can determine whether the present request has the myplugin variable (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.

    Anyone? Thanks!

  • The topic ‘Prevent the usual database queries?’ is closed to new replies.