I can’t find any info on this anywhere but i’m sure iv’e seen it done before.

I would like to have a user taken to the settings page for my plugin after install, so either auto-redirected or change the “back to plugins” link to a custom link.

Thanks in advance

SOLVED

function myplugin_activate() {    
    // TODO: Install your plugin here.

    // I don't know of any other redirect function, so this'll have to do.
    wp_redirect(admin_url('options-general.php?page=myplugin_settings'));exit;
    // You could use a header(sprintf('Location: %s', admin_url(...)); here instead too.
}
register_activation_hook(__FILE__, 'myplugin_activate');

@Zack – Your method works great however you forgot to exit after wp_redirect. (source http://codex.wordpress.org/Function_Reference/wp_redirect)

Many thanks

3 s
3

Register an activation hook and then redirect the user’s browser when you’re done installing your plugin.

function myplugin_activate() {    
    // TODO: Install your plugin here.

    // I don't know of any other redirect function, so this'll have to do.
    wp_redirect(admin_url('options-general.php?page=myplugin_settings'));
    // You could use a header(sprintf('Location: %s', admin_url(...)); here instead too.
}
register_activation_hook(__FILE__, 'myplugin_activate');

Leave a Reply

Your email address will not be published. Required fields are marked *