How to Redirect to Admin Page After Theme Activation In WordPress

Most of the times, you redirected to welcome page after activation of theme. If you want to use this trick in your theme, add below code in functions.php file of your theme.

add_action('admin_init', 'hs_activation_redirect');
function hs_activation_redirect()
{
    global $pagenow;
    if (is_admin() && $pagenow == "themes.php" && isset($_GET['activated'])) {
        wp_safe_redirect(admin_url("admin.php?page=hs_welcome"));
    }
}

The “hs_welcome” is custom admin page (The “Welcome” page).