[wp-hackers] Best practice way for a plugin to use WP_Rewrite

Matt Jacob matt at mattjacob.com
Fri Nov 13 00:25:04 UTC 2009

On Thu, Nov 12, 2009 at 12:23 PM, Tuna Can <tunamaxx at yahoo.com> wrote:
> A little perseverance paid off...  My whole issue relates to trying to hook in the flush_rules() at 'init' instead of 'admin-init' as required.

I don't think that's entirely true. On plugin activation, I'm doing this:

add_action('init', array($this, 'FlushRewriteRules'));

Every time the plugin is loaded, I'm doing this:

add_filter('rewrite_rules_array', array($this, 'InsertRewriteRules'));

Seems to work pretty well for me. Maybe you were running into a
problem somewhere else?


More information about the wp-hackers mailing list