[wp-hackers] Any way to bypass $wp->query_posts()?

Otto otto at ottodestruct.com
Thu Apr 9 16:45:52 GMT 2009


On Wed, Apr 8, 2009 at 7:23 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
>> If you don't need post content or any template logic,
>> I don't see why you'd need WordPress at all.
>
> The valid scenarios I envision *do* need WordPress in ~90% of cases but not for the ~10% of cases where I want to respond to custom URLs.  Currently the only options WordPress provides are "all or nothing." Why should it not not be valid to have "all" 90% of the time and "nothing" 10% of the time?

That is perfectly valid, however, your solution doesn't give you
"nothing" 10% of the time. You're still loading all of WordPress when
you clearly don't need to do so. This is suboptimal.

> I'm sorry but I can't take "modify .htaccess" as a serious suggestion for a plugin for reasons I spelled out above. Besides, I *do* need most of WordPress for these URLs, just not ALL of it (i.e. not the query.) Why is my saying "I only don't need the query" being interpreted as "I don't need WordPress at all?"

Because, and I think you're not getting this, the query *IS*
WordPress. Every page on WordPress needs the query. It's a fundamental
assumption underlying the whole architecture. ALL pages in WordPress
are generated from stuff in the posts table. Without exception.

If you're not loading anything from the posts table, then why load any
part of WordPress at all? There's nothing in WordPress that you need
if you're not loading something from the posts table as well.

> I don't understand the pushback for what is a very simple issue.  Can anyone give me a scenario would the one "if" statement I proposed would actually cause harm?

It's not about causing "harm". It's about "why bother?" None of the
scenarios you present make the slightest bit of sense. You keep saying
you want WordPress without the query, but you're failing to get that
without the query, there's no reason to load WordPress at all. You
gain nothing by loading WordPress. Almost every single part of
WordPress is predicated on loading something from the posts table.
It's a fundamental underlying assumption, in all cases.

See, what you're asking makes absolutely no sense to me. If you don't
want the query, then why load WordPress at all? Why not bypass
WordPress in such a way that you can load your own page (which is what
you claim to want to do) and save all the large amount of processing
required to load WordPress?

The solution you proposed, frankly, sucks. It causes a lot of loading
of PHP files and processing and so on that is pretty pointless if you
don't execute the main query. That's the reason for the pushback
you're getting. Your idea simply makes no reasonable sense.

-Otto
Sent from Memphis, Tennessee, United States


More information about the wp-hackers mailing list