Make WordPress Core

Opened 5 years ago

Last modified 8 months ago

#40032 new defect (bug)

Automatic redirects with _wp_old_slug won't mantain GET parameters if present

Reported by: DrLightman Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.1
Component: Permalinks Keywords: has-patch needs-testing
Focuses: Cc:


If for example links come up with GET parameters, for example utm parameters for analytics, they get stripped before the redirect.

post_name = 'new-slug'
_wp_old_slug = 'old-slug'


Wordpress will build the link for the redirect to the new slug without any GET parameter:


I think it should mantein them instead:


I'm not even sure if this should be classified as a bug, if it's the correct behaviour or not. I'll let you judge.

Attachments (2)

40032.patch (562 bytes) - added by desrosj 5 years ago.
Preserve $_GET params on _wp_old_slug redirects
40032.2.patch (492 bytes) - added by brookedot 8 months ago.

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
5 years ago

  • Summary changed from Automatic redirects with _wp_old_slug won't mantein GET parameters if present to Automatic redirects with _wp_old_slug won't mantain GET parameters if present

5 years ago

Preserve $_GET params on _wp_old_slug redirects

#2 @desrosj
5 years ago

  • Keywords has-patch needs-testing added

#3 @brookedot
8 months ago

  • Version set to 2.1

#4 @brookedot
8 months ago

  • Keywords needs-refresh added

#5 @brookedot
8 months ago

I'll give refreshing @desrosj's patch a go. As old_slug_redirect_url is filterable there is a workaround to add the query parameters with that filter but I think having it fixed in core would be great.

8 months ago

#6 @brookedot
8 months ago

  • Keywords needs-refresh removed
Note: See TracTickets for help on using tickets.