[wp-hackers] The problem with WP_Rewrite <<< RE: Options for Controller - Views

Jacob Santos wordpress at santosj.name
Wed Nov 25 00:56:33 UTC 2009

My main problem with wanting to rewrite it and I apologize for going off 
on a tangent, is that I shouldn't have to think and test as much as I do 
when working with WP_Rewrite. I shouldn't have to do all sorts of calls 
to functions to set up a rewrite when all I need to do is use one hook. 
Why do I have to use the long way, when I can just use the shortcut 
named template_redirect.

My point is why even have all of that code when you have to use 
template_redirect anyway.

You are telling me and actually believe that it is an excellent idea, 
which I can't understand, that I can either spend hours going through 
and using WP_Rewrite just to have to use template_redirect. You are 
basically telling me that my only advantage is that I won't get the 404 
title when WP_Query parses the query vars and determines that the page 
doesn't exist.

So the option is spend four hours on just getting WP_Rewrite to work, 
and then another 10 to 30 minutes to get template_redirect working with 
the query_vars.


I can spend an extra 20 minutes doing my own regex or request_uri 
parsing. Yeah, sure, the only advantage I'll get is that my 
template_redirect won't make you cringe when you look at it.

I think the high learning curve is driving many people away. It doesn't 
work like you would assume it will work and requires a lot of extra work 
that has to be done exactly right in order to work correctly.

What I'm talking about is a single function which is it, one single 
function that can be called anywhere and will bypass WP_Query 
completely. WP_Query will use the new system, thus giving a better idea 
and an example of how plugin developers should be doing it. I'm talking 
about a clear and easy API which is not so tightly integrated in to 
WordPress that you need to bypass WordPress after WordPress has already 
processed everything in order to do what you wanted.

Now, sure, I'll give you that once I am able to get the WP_Rewrite 
working once and understand what is going on, it will take a lot less 
time, but it doesn't work as many of the other controllers 
implementations out there do. I think that it is incomplete, everything 
right now was written not to allow for extension, but to allow for 
WordPress to kind of have a sort of front controller implementation.

It is actually quite impressive for its time, but that was years ago and 
I think it is time for a little bit change. Yeah, sure it works and has 
been working for a long, long time with minor or no issues, but I want 
to change that. I want to rewrite a tiny and critical subset of 
WordPress that will have bugs, features that people won't need and may 
not use for a long time. I will do this, because it suits my needs and I 
want to manage another component for some time before it gets passed off 
to anyone who will manage it after me.

I mean, it will probably be 6 months to a year before it is reviewed for 
inclusion in to WordPress. Also, it might be useful to someone who 
wishes to take my idea in the future and apply it to WordPress and 
hopefully is capable enough to not include bugs or fix the ones in my 

I should have left a note saying that I won't be able to do this for 
another 2 weeks at least. I keep thinking about doing this, but it is 
time consuming and before I was doing it for WordPress and I was unsure 
if any of the ones with commit access would commit it. I didn't want to 
spend the weeks writing it and then take the risk of it not being 
committed. Now that I'm doing it for me, I'm less concerned about that. 
I'm saying it might be soon or it might not, but I wanted to know what 
everyone else would like the direction to be.

Jacob Santos

More information about the wp-hackers mailing list