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

Mike Schinkel mikeschinkel at newclarity.net
Thu Apr 9 01:43:51 GMT 2009

"SoJ Web" <sojweb at indiana.edu> write:
> Generating rewrite statements is hardly difficult, 

It's not difficult, unless of course the .htaccess can't be written to. Then, for many users, it's insurmountable.

> don't think telling Apache to do it is any more difficult or 
> any less robust than having PHP do it.

PHP is essentially a modern programming language with control structures, variables, information hiding, exception handling, etc.  mod_rewrite is a simple declarative solution that depends on a pattern matching language notorious for it's unintended side-effects. I think you'd be hard pressed to argue among computer scientists that mod_rewrite is as easy to make robust as PHP if you are using the term "robust" as it is defined[1] in computer science.

> This could be much better accomplished with a custom 
> theme. Why not just make custom template files for 
> those slugs? 

Of course a custom theme page will be needed for each of those. But how does having a custom theme page address the underlying concern to not run a query when it is not needed (or more broadly, for the functions I listed to recognize that the URL is in fact custom and not already understood by WordPress?)

> Aside from that, if this hypothetical web host doesn't 
> allow the htaccess file to be modified, you can't use 
> permalinks, or any sort of URL rewriting, anyway, so 
> that point is moot.

It's not moot. Some hosts lock down files after initial installation. Regardless, it's my strong opinion that modifying .htaccess is simply the wrong architectural solution for the problem. Just because if works for you in your specific use-cases doesn't make it a reasonable general purpose solution.

That said you haven't, as I've requested, explained why having a simple "if" to bypass the query would be a problem. If you must persist to debate at least address that question, please.  

-Mike Schinkel
Custom Wordpress Plugins

[1] http://en.wikipedia.org/wiki/Robust#Computer_Science

More information about the wp-hackers mailing list