Created
June 7, 2018 06:53
-
-
Save nikitasinelnikov/af9cab778c9e263544618e2abbdbf3c4 to your computer and use it in GitHub Desktop.
Create redirect from WP native login form to UM login form
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
/** | |
* Replace login page URL to UM login page | |
* @param string $login_url | |
* @param string $redirect | |
* @return string | |
*/ | |
function um_login_url( $login_url, $redirect ){ | |
$page_id = UM()->options()->get( 'core_login' ); | |
if ( get_post( $page_id ) ) { | |
$login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), get_permalink( $page_id ) ); | |
} | |
return $login_url; | |
} | |
add_filter('login_url', 'um_login_url', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment