Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JudeRosario/4ab8440da7daaa319ebc to your computer and use it in GitHub Desktop.
Save JudeRosario/4ab8440da7daaa319ebc to your computer and use it in GitHub Desktop.
WordPress - Custom Login, Register and Logout Links
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 ;
}
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 ;
}
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;
}
@JudeRosario
Copy link
Author

Just copy/paste the code into the functions.php file of your child theme or a site specific plugin if you use one.

@JudeRosario
Copy link
Author

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