Redirect to settings page after install

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 Comment