Last active
August 29, 2015 14:18
-
-
Save JudeRosario/4ab8440da7daaa319ebc to your computer and use it in GitHub Desktop.
WordPress - Custom Login, Register and Logout Links
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
add_filter( 'login_url', 'custom_login_page', 10, 2 ); | |
function custom_login_page( $login_url, $redirect ) { | |
// Put your login page here | |
$custom_login_url = 'http://google.com' ; | |
return $custom_login_url ; | |
} |
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
add_filter( 'logout_url', 'custom_logout_page', 10, 2 ); | |
function custom_logout_page( $logout_url, $redirect ) { | |
// Put your logout page here | |
$custom_logout_url = 'http://google.com' ; | |
return $custom_logout_url ; | |
} |
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
add_action( 'register' , 'register_replacement' ); | |
function register_replacement( $link ){ | |
// Put your Register page here | |
$register_url = 'http://google.com' ; | |
if ( ! is_user_logged_in() ) { | |
if ( get_option('users_can_register') ) | |
$link = $before . '<a href="' . $register_url . '">' . __('Register') . '</a>' . $after; | |
else | |
$link = ''; | |
} else { | |
$link = $before . '<a href="' . admin_url() . '">' . __('Your Title Here') . '</a>' . $after; | |
} | |
return $link; | |
} |
Remeber to replace $register_url
, $custom_logout_url
and $custom_login_url
with your own links
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just copy/paste the code into the functions.php file of your child theme or a site specific plugin if you use one.