Woocommerce Restrict My Account Page but NOT Lost Password Page
Woocommerce Restrict My Account Page but NOT Lost Password Page I have a WordPress site with Woocommerce. In Woocommerce, Lost Password URL merges with My Account page (www.site.com/my-account/lost-password/) . (www.site.com/my-account/lost-password/) Then I create a redirect function that will redirect non-logged in users when they hit "My Account" page to "Login" page. This means I limit them too to access the Lost Password page. add_action( 'wp', 'redirect' ); function redirect() { if ( is_page(array('my-account', 'payment-screen', 'submit-resume', 'post-a-job')) && !is_user_logged_in() ) { wp_redirect( home_url('/login') ); die(); } elseif ( is_page(array( 'register', 'login' )) && is_user_logged_in() ) { wp_redirect( home_url('/my-account') ); die(); } } I want to restrict non-logged in users only for www.site.com/my-account/ and redire