[wp-hackers] Make WP_Rewrite eaiser to use

Sam Angove sam at rephrase.net
Mon Feb 6 09:57:53 GMT 2006


On 2/6/06, Peter Westwood <peter.westwood at ftwr.co.uk> wrote:
> Doing things this way breaks when we need index.php/permalinks/ the
> whole reason for providing an API is that WP_Rewrite can take care of
> the nasty stuff like that and let you get on with writing your plugin.

I was actually going to suggest prepending `index.php` globally (and
converting $1 to $matches[1], etc) after the array filter, instead of
one at a time during `generate_rewrite_rules()`.

But you're right, that is a good reason.


> This level of abstraction is usefull, and opens up the addition of rule
> types to more plugin developers - they need not understand PCRE to add a
> new endpoint type for example.

True (for your proposed add_endpoint() function), but they'll still
need to understand them to use add_rewrite_rule().

Something much more abstracted might be interesting...
   add_rewrite_rule('%tag%/%tag2%', 'index.php?a=%tag%&b=%tag2%');


More information about the wp-hackers mailing list