Last active
April 9, 2020 01:05
-
-
Save KaineLabs/92187abb7e2be58d7f4ddb21baf3f5f0 to your computer and use it in GitHub Desktop.
Redirect Logged-in Users from Home Page to Their Profile
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 | |
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