Created
May 23, 2019 02:24
-
-
Save KaineLabs/90b54fcbf43bbedcd1572022fc21dc85 to your computer and use it in GitHub Desktop.
Redirect User Profile to Home Page
This file contains 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 | |
/** | |
* Redirect User Profile to Home Page. | |
*/ | |
function yzc_redirect_user_profile_to_homepage() { | |
// List of forbidden profiles user ids | |
$forbidden_users = array( 100 ); | |
if ( bp_is_user() && in_array( bp_displayed_user_id(), $forbidden_users ) ) { | |
wp_redirect( home_url() ); | |
exit(); | |
} | |
} | |
add_action( 'template_redirect', 'yzc_redirect_user_profile_to_homepage' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment