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

Otto otto at ottodestruct.com
Thu Nov 26 19:24:40 UTC 2009

On Tue, Nov 24, 2009 at 6:56 PM, Jacob Santos <wordpress at santosj.name> wrote:
> 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.

Umm... because template_redirect and WP_Rewrite don't do the same
things in any way, shape, or form?

- You use template_redirect to change the final output of the
WordPress system, to basically create a custom "view".
- You use WP_Rewrite to parse the URL into query_variables.

These aren't even close to similar. They have absolutely zero to do
with each other. Why in the world would you want to combine them in
any real way?

> 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.

No, I'm telling you that you're completely confusing these two
entirely separate and different subsystems, and I really don't
understand why.

Also, hours? It's like 5 lines of code to add a new rewrite rule. I
would think that the "add_rewrite_rule" function is relatively
straightforward. The add_tag stuff is even easier, if you want to
stick close to the existing structures.

Okay, the flush rules stuff could be done better, I grant you. This is
a speed optimization that needs to be worked on.

> 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.

Okay, I'm no super-genius, but I understood exactly what it was doing
in about 30 minutes. It works exactly the way I expect it to work.

I am totally and completely confused with your concept of somehow
integrating the rewrite parsing system into the controller and router.
That makes little sense to me. It confused me with the Zend MVC system
as well, because (and this is key) I don't want URLs to immediately
direct to a specific view, I want URLs to determine dynamic

URLs are not Views. If I have a URL like /tag/whatever then I might
want to set $tag=whatever, not to direct to the "tag" view with
"whatever" as a parameter. Because what if I want to combine
parameters? How would your concept handle /category/X/tag/Y ?

> 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.

On the contrary, I find the WordPress system to be far more flexible,
easier to understand, and easier to use.

I would absolutely not support your system without a better
explanation of exactly what the hell you're talking about. Because
what you're describing, as I see it, is a massive step backwards.


More information about the wp-hackers mailing list