Make WordPress Core

Opened 11 years ago

Last modified 5 weeks ago

#27632 reviewing defect (bug)

`wp_registration_url()` doesn't have a redirect argument

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by: chriscct7's profile chriscct7
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Login and Registration Keywords: has-patch
Focuses: ui Cc:

Description

There is a redirect argument for each of the login, logout, lostpassword url functions, but for the registration url function.

Omission or done on purpose?

Attachments (1)

registration-url-redirect.27632.diff (1.0 KB) - added by sanchothefat 9 years ago.
Patch adds redirect parameter to wp_registration_url

Download all attachments as: .zip

Change History (8)

#1 @Denis-de-Bernardy
11 years ago

On a related note, I'm noting a different logic in multisite and non-multisite in the wp-signup.php file, and a direct call to site_url('wp-login.php?action=register') within it, so I presume this rabbit hole is deeper than it looks on the surface.

#2 @juliobox
11 years ago

Hello
What about "registration_redirect" ? (/wp-login.php, line 687 on WP3.9b3)

Last edited 11 years ago by juliobox (previous) (diff)

#3 @jeremyfelt
11 years ago

  • Version changed from trunk to 3.6

#4 @chriscct7
9 years ago

  • Keywords needs-patch added

@sanchothefat
9 years ago

Patch adds redirect parameter to wp_registration_url

#5 @sanchothefat
9 years ago

  • Keywords has-patch added; needs-patch removed

The registration_redirect filter in wp-login.php seems to be the exception to the rule in the login/forgot/register forms. There's a valid use case for having the filter in the wp_registration_url() function if it's used on the front end. You could set up logic to return a user to their previous location on the site without relying on the referrer. There's also code that respects the redirect_to get or post param if set so this makes sense IMO.

#6 @chriscct7
9 years ago

  • Owner set to chriscct7
  • Status changed from new to reviewing

This ticket was mentioned in PR #7725 on WordPress/wordpress-develop by @nirajgirixd.


5 weeks ago
#7

## Description

This PR adds an optional $redirect parameter to wp_registration_url(), enabling redirection after registration, similar to other WordPress URL functions. If a redirect URL is provided, it’s added as a redirect_to query argument.

## Changes Made

Added $redirect Parameter:

  • Allows specifying a redirect URL for post-registration navigation.
  • Checks if $redirect is provided, and if so, adds it as a redirect_to query argument to the base registration URL.
  • The function now filters the updated $register_url and includes the $redirect parameter in the filter hook, ensuring custom modifications to the registration URL also have access to this parameter.

## Testing Instruction

  • Check wp_registration_url() with and without a redirect parameter.
  • Verify that the generated URL correctly includes the redirect_to parameter when specified.

## Trac ticket: https://core.trac.wordpress.org/ticket/27632

Note: See TracTickets for help on using tickets.