By default, there is no option to restrict member pages for non members, but it is pretty easy to achieve using a simple PHP code snippet:
1 2 3 4 5 6 7 8 9 10 11 |
/** * Redirect buddypress pages to registration page */ function gwangi_restrict_buddypress() { // If not logged in and on a bp page except registration or activation if ( ! is_user_logged_in() && is_buddypress() && ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) { wp_redirect( home_url( '/register/' ) ); exit(); } } add_action( 'template_redirect', 'gwangi_restrict_buddypress' ); |
This code snippet will redirect your visitors to the register page whenever they try to access a BuddyPress page.
Heads up! Don’t know how to add a PHP code snippet to your site ?
If you want to find out how to add a PHP code snippet to your site, you can visit this other article of our documentation: Adding Custom PHP Without Changing Your Child Theme.
If you want to find out how to add a PHP code snippet to your site, you can visit this other article of our documentation: Adding Custom PHP Without Changing Your Child Theme.