Make WordPress Core

Opened 8 years ago

Last modified 4 years ago

#39442 new defect (bug)

Custom rewrite endpoints and wp_old_slug_redirect

Reported by: batmoo's profile batmoo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Rewrite Rules Keywords:
Focuses: Cc:

Description

Previously: #33920

wp_old_slug_redirect currently only handles core rewrite endpoints (like feed and embed). If you have a custom rewrite endpoint, you end up redirected back to the new permalink.

You can use the [old_slug_redirect_url https://developer.wordpress.org/reference/hooks/old_slug_redirect_url/] filter to redirect correctly but the filter does not pass the post id, which makes things a bit challenging (especially if you need to do any processing beyond just appending the endpoint).

It would be nice if the post id was passed into the old_slug_redirect_url filter:

$link = apply_filters( 'old_slug_redirect_url', $link, $id );

It would be even nicer if the redirect handled custom endpoints automatically as well.

Attachments (1)

39442.patch (549 bytes) - added by MikeSchinkel 6 years ago.
Patch to include $id as a parameter

Download all attachments as: .zip

Change History (2)

@MikeSchinkel
6 years ago

Patch to include $id as a parameter

This ticket was mentioned in Slack in #core by noisysocks. View the logs.


4 years ago

Note: See TracTickets for help on using tickets.