Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nikitasinelnikov/af9cab778c9e263544618e2abbdbf3c4 to your computer and use it in GitHub Desktop.
Save nikitasinelnikov/af9cab778c9e263544618e2abbdbf3c4 to your computer and use it in GitHub Desktop.
Create redirect from WP native login form to UM login form
/**
* 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