How to exclude a child page in 301 redirect using functions.php
Question
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( 'https://www.example.com/my-account/sign-in/', 301 );
exit;
}
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.
0
2 months
0 Answers
11 views
0
Leave an answer
You must login or register to add a new answer .