Skip to content

Instantly share code, notes, and snippets.

@Kudratullah
Last active February 18, 2021 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Kudratullah/263505fed8e507230d54 to your computer and use it in GitHub Desktop.
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.
<?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