[wp-hackers] Make WP_Rewrite eaiser to use
dmhouse at gmail.com
Mon Feb 6 11:04:48 GMT 2006
On 05/02/06, Sam Angove <sam at rephrase.net> wrote:
> Are there any other hooks/filters that get convenience wrappers?
> They're pretty convenient as-is. The current way is very flexible, and
> it only looks verbose when it's for the sake of one query var -- I had
> a plugin with about eight, and three times that many rewrite rules,
> and it was very nice indeed.
> Without your callback, does this do enough to make it worth the
> bother? The query_vars filter is the easy bit anyway, and this API is
> much less efficient if you're adding more than one QV.
Are you proposing we give up on the API idea? Here's why I think it's necessary:
1) Plugin authors want a simple solution to a simple problem. Adding,
say, a single rewrite rule is a simple problem and so we should
provide a simple function for it.
2) It gives us a level of abstraction so we can refactor WP_Rewrite at
a later date without worrying about breaking the plugin-facing
I just think that having to hook three or more filters to add a new
rewrite tag is too much. It may not seem unbearable when you have
eight QVs, but I'd think that yours is the edge case and skippy's more
Something like the example I pointed out  illustrates the power of
just the two simple functions I proposed. Westi's would make
everything a lot more flexible.
I don't see any reason not to add the API.
I'll probably be drafting up patches for add_rewrite_rule() and
add_rewrite_tag() over the next few days (with the others following)
unless anyone disagrees.
-David House, dmhouse at gmail.com, http://xmouse.ithium.net
More information about the wp-hackers