Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#16411 closed enhancement (invalid)

Custom Login and Registration URLs

Reported by: danielpataki Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:


For bigger websites it would be beneficial to allow custom registrations by being able to change the login and registration urls. You can change the login url in a haphazard way now like this, but this is not very good.

function bsb_login_url($redirect_to) {
	$redirect_to = str_replace(get_bloginfo("url").'/wp-login.php', '', $redirect_to);
	$link = get_bloginfo("url")."/login/".$redirect_to;
	return $link;
add_filter( 'login_url', 'bsb_login_url' );

Looking at wp-login.php, the registration link is output like this:

<a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a>

If, by using a filter, hook, or even a definition in the config file, you could change the url output here that would be nice.

Change History (12)

comment:1 @danielpataki5 years ago

Just want to add quickly, that this can also be accomplished in another bad way like this:

add_action("init", "bsb_register_redirect") ;

function bsb_register_redirect() {
	if(get_current_url(true) == get_bloginfo('url')."/wp-login.php?action=register")
	header("Location: http://bitesizebio.com/register/");
Last edited 5 years ago by danielpataki (previous) (diff)

comment:2 follow-up: @SergeyBiryukov4 years ago

There are plugins for that. Theme My Login is one for example.

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

comment:3 in reply to: ↑ 2 @markmcwilliams4 years ago

Replying to SergeyBiryukov:

There are plugins for that. Theme My Login is one for example.

I think he's on about having site.com/login/ and site.com/register/ instead of the site.com/wp-login.php and site.com/wp-login.php?action=register we currently have, although this will more than likely be plugin material, as it can be achieved through either functions.php or a plugin!

comment:4 follow-up: @SergeyBiryukov4 years ago

Theme My Login can do that. Sorry for the wrong link, fixed.

comment:5 in reply to: ↑ 4 @markmcwilliams4 years ago

Replying to SergeyBiryukov:

Theme My Login can do that. Sorry for the wrong link, fixed.

Oh, I never noticed I was looking at the wrong plugin!

comment:6 @danielpataki4 years ago

It's not the fact that it can not be done which is the problem, I just think that this should be something the core could support. For larger websites, having a more elaborate registration, lost password and login process is a must, and it would be easier to achieve with built in support.

comment:7 @ptahdunbar4 years ago

  • Cc trac@… added

comment:8 @Moskjis4 years ago

There exists a wp_login_form function to address this (at least, part of it).

comment:9 @RyanMurphy4 years ago

Ozh has a plugin that does /login instead of /wp-login.php. I don't think it would be too hard for it to also handle /register if someone asked/sent him a patch.

comment:10 @sucipto823 years ago

  • Summary changed from Custom Login and Registration URLs to http://scrapeboxmurah.blogspot.com/2012/05/iklan-internet-murah-efektif.html


Last edited 3 years ago by dd32 (previous) (diff)

comment:11 @dd323 years ago

  • Summary changed from http://scrapeboxmurah.blogspot.com/2012/05/iklan-internet-murah-efektif.html to Custom Login and Registration URLs

comment:12 @scribu3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

There's nothing haphazard about using the 'login_url' filter; it's the standard way of extending WordPress.

What's missing is a matching wp_register_url() and is_login_url() functions, which are addressed in #19898

Note: See TracTickets for help on using tickets.