Last active
February 3, 2020 12:18
-
-
Save nfmohit/cc7db057a5f63f736d488d5186ea4ed3 to your computer and use it in GitHub Desktop.
BuddyPress private profile (Redirect to homepage if it is not the current user's profile)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('template_redirect', 'bp_private_profile'); | |
| function bp_private_profile() { | |
| if ( ! current_user_can( 'manage_options' ) ) { | |
| if ( bp_is_user_profile() && ! bp_is_my_profile() ) { | |
| wp_redirect( home_url() ); | |
| exit; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment