如何为WordPress中已注销的用户添加重定向异常

I have the code below to redirect my WordPress logged out users to page /login/

<?php
if (!is_user_logged_in()) {
    if ( ! is_page( 'register-member' ) )
     if ( ! is_page( 'groups' ) ){
 wp_redirect( 'https://members.google.com/login/');
 exit;
} 
} ?>

And currently i whitelisted /register-member/ and /groups/ so logged out users can access them.

But I'm trying to whitelist more pages and it's not working and I think it's overwritten by the theme (BuddyPress)

Also i'm using "Restrict Content Pro" plugin

So i'm looking for a solution to whitelist other pages.

You can do these things with is_user_logged_in() and is_front_page(). If these are not true, then you can use wp_redirect() to redirect the user to the home page.

Assuming your forgot password page is a "page," you could use is_page() in your logic as well.

You'll need to hook it to action so that it fires late enough to allow checking the page, but early enough to still safely redirect the user (i.e. before headers are sent). template_redirect is ideal for this.

add_action( 'template_redirect', 'my_frontpage_redirect' );
function my_frontpage_redirect() {
    if ( ! is_user_logged_in() ) {
        if ( ! is_front_page() && ! is_page( 'my-password-reset' ) ) {
            wp_redirect( home_url() );
            exit();
        }
    }
}