WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to redirect a user once they click "activate" on my plugin, the redirect is working great using the register_activation_hook however the plugin is failing to activate.

Any thoughts on what i need to do to make it run the hook after activation and not before?

function install_redirect() {
register_activation_hook(__FILE__, 'install_redirect');


share|improve this question
up vote 1 down vote accepted

From stackoverflow: http://stackoverflow.com/questions/2450510/redirect-after-plugin-activation

register_activation_hook(__FILE__, 'my_plugin_activate');
add_action('admin_init', 'my_plugin_redirect');

function my_plugin_activate() {
    add_option('my_plugin_do_activation_redirect', true);

function my_plugin_redirect() {
    if (get_option('my_plugin_do_activation_redirect', false)) {
share|improve this answer
Many thanks Rob – Danny Feb 19 '12 at 23:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.