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

Jennifer Hodgdon yahgrp at poplarware.com
Wed Apr 8 19:03:02 GMT 2009


> BTW, one thing I am finding is that the concept of using WP_Rewrite is far from fleshed-out. There are many places in WordPress where the "type" of a URL is hardcoded in implicit fashion. The most recent example I found was in wp_title(). wp_title() makes a bunch of assumptions but doesn't give the 'wp_title' hook any context to know what it's operating on so you can't really generate an appropriate title for your URL. Thus even though people on this list say "The right way to do handle custom URLs is via WP_Rewrite" the reality is that logic path has never been tested and has many issues. I'd like to eventually address all of those by providing a "custom URL" escape valve in all relevant contexts, but for now I'd like to just be able to bypass running the query.

Functions like wp_title() and other "template tag" functions are meant 
to be used with the standard WP query mechanism and/or The Loop. It is 
no surprise that they would not work if you bypass the standard WP 
query mechanism and create your own page. Trying to make some of these 
functions work will not really help -- they will never all work, 
anyway, if you are not querying to find a list of posts.

     --Jennifer

ps: In my opinion, if you want to do a lot of this custom URL stuff, 
you are much better off starting with a CMS that has an "arbitrary 
behavior for arbitrary URL" architecture built into it at its core 
(such as Drupal), rather than trying to build a whole system for 
overriding URLs in a CMS that has an assumption of "query for 
posts/pages" built into it at its core (such as WordPress). I'm not 
saying it cannot be done in WP, and certainly there are mechanisms for 
the occasional one-off URL override, but is it the right tool for what 
you need to do? Just a thought...

-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal, WordPress, and custom Web programming



More information about the wp-hackers mailing list