Maybe this will not work as the cookie does not get set due to redirect?
I have this code also
add_action( ‘template_redirect’, ‘my_redirect_if_user_not_logged_in’ );
function my_redirect_if_user_not_logged_in() {
if ( !is_user_logged_in() && is_page(‘3434’) ) {
wp_redirect( ‘https://www.mysite.com/register ‘);
exit;
}
}
-
This reply was modified 1 year, 2 months ago by alex20231.