Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/90b54fcbf43bbedcd1572022fc21dc85 to your computer and use it in GitHub Desktop.
Save KaineLabs/90b54fcbf43bbedcd1572022fc21dc85 to your computer and use it in GitHub Desktop.
Redirect User Profile to Home Page
<?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