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
guerillaradio 8 months 2020-11-25T08:10:27-05:00 0 Answers 11 views 0

Leave an answer

Browse
Browse