How to Redirect Page On WordPress Theme Activation

Here’s an example code to do theme activation redirect:

/* Redirect on theme activation */
add_action( 'admin_init', 'prifix_activation_redirect' );
 
 
/**
 * Redirect to "Install Plugins" page on activation
 */
function prifix_activation_redirect() {
    global $pagenow;
    if ( "themes.php" == $pagenow && is_admin() && isset( $_GET['activated'] ) ) {
        wp_redirect( esc_url_raw( add_query_arg( 'page', 'because', admin_url( 'themes.php' ) ) ) );
    }
}