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

Matt Jacob matt at mattjacob.com
Tue Dec 8 23:17:44 UTC 2009


On Tue, Dec 8, 2009 at 4:03 PM, Austin Matzko <if.website at gmail.com> wrote:
> Yes, and you'll also need to attach to "init" the callback that sets
> up the rules.

Is that the 'init' action, or my plugin's init function (the constructor)?

Does that mean that the Codex is wrong, then? It lists plugins_loaded
as coming before init
(http://codex.wordpress.org/Plugin_API/Action_Reference), which is
probably what made me think I could do it this way in the first place.

To further complicate things, the docs for register_activation_hook()
say that the callback passed to that function doesn't have access to
global variables at the point when it's called. Does that include WP
globals like $wp_rewrite?

Matt


More information about the wp-hackers mailing list