Where to hook to bypass instantiating WP_Query?

While it’s possible to get rid of WP_Query in WP load process it’s pretty horribly inconvenient to accomplish. 🙂

Let’s recap the process as related to rewrite:

  1. Web server takes pretty permalink and rewrites it to WP’s index.php.
  2. WP takes “pretty” part and applies its rewrite rules to it, turning it into query variables.
  3. Query variables are processed and fed into a WP_Query.
  4. Depending on results of query vars and retrieved posts conditionals are set up.
  5. Conditionals are used to determine template.
  6. Template is used to display posts, if any.

So it is a little hard to understand from your description how do you need to integrate your things into this.

The most extensive scale would be to register your own query variables, your own rewrite rules, and make use of that data in WP_Query.

But if you aren’t actually interested in querying posts and whole shebang the least involved way is to let WP come to 404 conclusion, then hook around template_redirect and depending on your own custom logic either let it proceed or cancel it out and perform necessary actions.