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

Tuna Can tunamaxx at yahoo.com
Fri Nov 13 21:43:53 UTC 2009

--- On Fri, 11/13/09, Peter Westwood <peter.westwood at ftwr.co.uk> wrote:
> Because the function save_mod_rewrite_rules() is only
> defined for admin pages. (It is in wp-admin/includes/misc.php)
> and WP_Rewrite uses that to save to the .htaccess file

This is what triggered my 'A ha!' moment yesterday. "Of course it has to be 'admin_init' to work" I thought to myself. However, Matt says he's having success with just 'init' on plugin activation, so I am a littel confused still.

OH! Maybe that is is? He's calling it through register_activation_hook where I am not. I want to be able to flush_rules() on option update.

By the way, I understand that I should NOT be calling the flush on every page load; this was just simple test code.



Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now

More information about the wp-hackers mailing list