Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KaineLabs/92187abb7e2be58d7f4ddb21baf3f5f0 to your computer and use it in GitHub Desktop.
Save KaineLabs/92187abb7e2be58d7f4ddb21baf3f5f0 to your computer and use it in GitHub Desktop.
Redirect Logged-in Users from Home Page to Their Profile
<?php
function yz_redirect_loggedin_user_from_home_to_profile() {
if ( is_user_logged_in() && ( is_home() || is_front_page() ) ) {
wp_redirect( bp_loggedin_user_domain() );
exit;
}
}
add_action( 'template_redirect', 'yz_redirect_loggedin_user_from_home_to_profile' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment