How to exclude a child page in 301 redirect using functions.php


I am using this code to redirect unlogged in users to a page to login.

        if ( is_page('my-account') && ! is_user_logged_in() ) {

wp_redirect( '', 301 ); 

But the problem is clicking on reset password also redirects to the login page. So I need to exclude the forgot password link from the redirect.

guerillaradio 2 months 0 Answers 11 views 0

Leave an answer