BLOG VVCARES WEB DESIGNER SINGAPORE

Web Designing | Web Hosting | Custom Software Apps | Email Marketing | Invoicing Software

Wordpress BuddyPress hide page from non-members, Non-Loggedin users..

- Posted in 19 February 2020 website designing by

How to hiding members page from non logged in users ?

Here the simple step to protect your Wordpress BuddyPress member only pages. Add this simple snippet into your theme's 'functions.php' file. That's it..

The below snippet sample will redirect the visitor if the visitor is not logged in & trying to visit the sensitive BuddyPress pages.

Will redirect non-logged-in users trying to access private content to your front page or home page

//Hide for non-logged-in users (public visitors)
function bp_logged_out_page_template_redirect() { if( ! is_user_logged_in() && is_page( 'members' )|| is_page( 'activity' ) || bp_is_user()  ) { wp_redirect( home_url( 'https://vvcares.com/?buddypressBlogPostRedirect' ) ); exit(); } } add_action( 'template_redirect', 'bp_logged_out_page_template_redirect' );