Last active
February 18, 2021 22:36
-
-
Save Kudratullah/263505fed8e507230d54 to your computer and use it in GitHub Desktop.
Customize WordPress Default Login URL Returned by wp_login_url() For adding custom login template via WordPress page template feature.
This file contains hidden or 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 | |
if(!function_exists('sekaiju_login_page')): | |
/** | |
* Change Default Login Url Regurned by wp_login_url() | |
* @param string $login_url | |
* @param string $redirect | |
* @return string | |
*/ | |
add_filter( 'login_url', 'custom_login_url', 10, 2 ); | |
function custom_login_url( $login_url, $redirect ) { | |
$postID = YOUR-CUSTOM-LOGIN-PAGE-ID;//get_option('custom_login'); | |
$redirect_to = ''; | |
if($redirect != "") | |
$redirect_to = '?redirect_to='.$redirect; | |
return get_permalink($postID) . $redirect_to; | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment