Last active
March 5, 2019 23:18
-
-
Save LMNTL/e21494788f8479ea2e8d705c7776c5ce to your computer and use it in GitHub Desktop.
Change /wp-admin/ Redirect After Login for Paid Memberships Pro
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 | |
/* Change /wp-admin/ Redirect After Login for Paid Memberships Pro */ | |
function my_pmpromh_login_redirect( $redirect_to, $request, $user ) | |
{ | |
$admin_url = get_admin_url(); | |
$landing_page_id = 11; //change this to the ID of the page you want to redirect the user to | |
if ( ! current_user_can( 'administrator' ) && $redirect_to == $admin_url ) { | |
$redirect_to = get_permalink( $landing_page_id ); | |
} | |
return $redirect_to; | |
} | |
add_filter( 'login_redirect', 'my_pmpromh_login_redirect', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment