Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Hide the MEMBERS, GROUPS, ACTIVITY pages

@henrywright

Moderator

Hi @dhyana

Put this in your theme’s functions.php file:

function my_redirect_pages() {
    if ( ! is_user_logged_in() && ( is_page( 'members' ) || is_page( 'groups' ) || is_page( 'activity' ) ) ) {
        wp_redirect( home_url() );
        exit();
    }
}
add_action( 'template_redirect', 'my_redirect_pages' );

This will block these pages for users not logged in. If you wanted to go one step further and limit access by membership then you’d need to modify the condition in the my_redirect_pages function slightly.

Skip to toolbar