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'])) {

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