redirect if user is not logged in.
-
I have a woocommerce site that I want to redirect users that are not logged in to the login page, but only for one product.
I have copied the single-product.php to my theme folder and added the following before “get header”
if( !is_user_logged_in() && $product_id = 7854 ) { wp_redirect('my-site-url'); }
but… this redirects all product links to login page. I only want one of them to redirect. How can I do this without using a plugin. I want to avoid that.
Any help would be greatly appreciated
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘redirect if user is not logged in.’ is closed to new replies.