BuddyPress Friends Only User Profile Privacy

Making your BuddyPress user profiles friends only is easy. I have seen a lot of people asking about it and today, we will see how to do it.

Our goal is to restrict access to user profiles to everyone except:-

  • Self:- The user themselves should be allowed to access their profile.
  • Site Admins:- There should be no restriction in site admins
  • Friends:- Users who are friends with the user being visited
  • Friendship requested:- Users who have been requested friendship by the profile owner.

You can add the following code to your to theme’s functions.php or bp-custom.php in your wp-content/plugins directory


You can changeĀ $where_to_redirect to point to anywhere you want the users to be redirected.

Have fun!

2 Responses to BuddyPress Friends Only User Profile Privacy

Leave a Reply

Are you looking for support?

Please ask support questions in BuddyDev Forum and help us serve you better. Please use comment for general discussion/feature suggestions.

Your email address will not be published. All the fields marked as * are required.

If you are posting code, please use <pre> { Your Code Block } </pre>. Example:- <pre> echo $name; </pre>

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">