WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 5 weeks 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:

Description

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'

http://example.org/old-slug/?utm_source=test1&utm_medium=test2&utm_campaign=test3

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

http://example.org/new-slug/

I think it should mantein them instead:

http://example.org/new-slug/?utm_source=test1&utm_medium=test2&utm_campaign=test3

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 4 years ago.
Preserve $_GET params on _wp_old_slug redirects
40032.2.patch (492 bytes) - added by brookedot 5 weeks ago.

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
4 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

@desrosj
4 years ago

Preserve $_GET params on _wp_old_slug redirects

#2 @desrosj
4 years ago

  • Keywords has-patch needs-testing added

#3 @brookedot
5 weeks ago

  • Version set to 2.1

#4 @brookedot
5 weeks ago

  • Keywords needs-refresh added

#5 @brookedot
5 weeks 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.

@brookedot
5 weeks ago

#6 @brookedot
5 weeks ago

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