BuddyDev

Making a WordPress & BuddyPress Site Private, the Right Way

Do you plan to make a WordPress & BuddyPress site private? Most of the plugins that claim to make a site private fail with BuddyPress activated. The problem is BuddyPress resets page ids for the pages used by BuddyPress. The simple solution that works with BuddyPress as well as WordPress is to hook into template_redirect action early.

Here is a snippet that prevents the users from viewing BuddyPress site content. We have excluded login page, register page, activation page and home page from the list.

You can put the above code in your theme’s functions.php or bp-custom.php in the plugins directory.

Hope that helps. Feel free to modify it and use it for your specific purpose.

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="">