Make WordPress Core

Opened 7 weeks ago

Last modified 7 weeks ago

#63082 new enhancement

Strip query strings in wp_redirect_admin_locations

Reported by: eclev91's profile eclev91 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: trivial Version: trunk
Component: Canonical Keywords: has-patch
Focuses: Cc:

Description

Downstream we're running into an issue where a plugin (Woo) that adds a query string to URLs for cache-busting purposes breaks the admin and login redirects in wp_redirect_admin_locations. See ticket here: https://wordpress.org/support/topic/geolocation-hashing-breaks-wp_redirect_admin_locations/#post-18353343.

While a workaround is certainly possible, and maybe Woo should be doing it differently, would it make sense to strip query strings from the request URI in this redirect's matching logic?

Change History (1)

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


7 weeks ago
#1

  • Keywords has-patch added

This fixes an issue where query parameters added by plugins (such as WooCommerce)
would break admin and login redirects. The function now strips query strings from
the request URI before comparing with admin/login URLs.

Previously, URLs like /admin?cache-buster=12345 would not be recognized as
admin URLs because the comparison was against the full URI including query strings.
This change maintains the original redirect functionality while being more
resilient to modifications by plugins.

Trac ticket: https://core.trac.wordpress.org/ticket/63082

Note: See TracTickets for help on using tickets.