Last active
July 22, 2020 03:08
-
-
Save KaineLabs/ab1bb9f85dfccadeaa4c2fa6390872ef to your computer and use it in GitHub Desktop.
Set Logged-in User Profile as 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 | |
/** | |
* Set Logged-in User Profile as Home Page | |
*/ | |
function yzc_set_profile_page_as_homepage() { | |
if ( is_user_logged_in() && is_front_page() ) { | |
global $bp; | |
wp_redirect( $bp->loggedin_user->domain ); | |
exit; | |
} | |
} | |
add_action( 'template_redirect', 'yzc_set_profile_page_as_homepage' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment