Redirecting the user away from the theme screen when a theme is activated is not allowed.
There are two ways to redirect on activation that are more common:
global $pagenow;
if (is_admin() && 'themes.php' == $pagenow && isset($_GET['activated'])) {
$theme_info = wp_get_theme();
$theme_name = $theme_info->get( 'Name' );
if($theme_name =='THEME NAME'){
wp_redirect(admin_url("themes.php?page=prefix_activation")); // Your admin page URL
}
}
function prefix_after_switch_theme(){
wp_redirect('admin.php?page=prefix-panel');
}
add_action( 'after_switch_theme', 'prefix_after_switch_theme' );
Note that neither wp_redirect or after_switch_theme on their own cause any problems.
This makes it difficult to test this requirement with a static code check.
A test could be set up to check if there is a redirect after theme activation.
Redirecting the user away from the theme screen when a theme is activated is not allowed.
There are two ways to redirect on activation that are more common:
Note that neither
wp_redirect
orafter_switch_theme
on their own cause any problems. This makes it difficult to test this requirement with a static code check.A test could be set up to check if there is a redirect after theme activation.