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 | Owned by: | 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)
Change History (8)
#5
@
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.
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 aredirect_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
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 tosite_url('wp-login.php?action=register')
within it, so I presume this rabbit hole is deeper than it looks on the surface.