roles)) {
return $redirect_to;
}
if (in_array('subscriber', (array) $user->roles, true)) {
return home_url('/subscriber/');
}
return $redirect_to;
}, 10, 3);
/**
* If a Subscriber visits the home page while already logged in, send them to the video library.
*/
add_action('template_redirect', function () {
if (!is_user_logged_in() || !is_front_page()) {
return;
}
$user = wp_get_current_user();
if (in_array('subscriber', (array) $user->roles, true)) {
wp_safe_redirect(home_url('/subscriber/'));
exit;
}
});