[wp-hackers] $wp_rewrite->flush_rules() on plugin activation

Austin Matzko if.website at gmail.com
Tue Dec 8 23:03:43 UTC 2009


On Tue, Dec 8, 2009 at 4:52 PM, Matt Jacob <matt at mattjacob.com> wrote:
> And what about filtering rewrite_rules_array? I assume that also needs
> to be done before flushing the rules.

Yes, and you'll also need to attach to "init" the callback that sets
up the rules.

So on activation:

- setup your rules
- flush rewrite rules

On init:

- setup your rules

That way your rule changes get used when the rewrite rules are flushed
by another plugin or on the permalinks admin page, etc.


More information about the wp-hackers mailing list