Created
October 9, 2020 18:10
-
-
Save dparker1005/2a3eb2b7ca1f5946df20af0ee7d82bf8 to your computer and use it in GitHub Desktop.
Redirects users to their user pages on login.
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 | |
// Copy from below here... | |
/* | |
* Redirects users to their user pages on login. | |
*/ | |
function my_pmpro_login_redirect_user_pages( $redirect, $requested_redirect_to, $user ) { | |
if ( isset( $user->ID ) ) { | |
$user_page_id = get_user_meta( $user->ID, "pmproup_user_page", true ); | |
if ( ! empty( $user_page_id ) ) { | |
$redirect = get_permalink( $user_page_id ) ?: $redirect; | |
} | |
} | |
return $redirect; | |
} | |
add_filter( 'login_redirect', 'my_pmpro_login_redirect_user_pages', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment