Opened 8 years ago
Last modified 4 years ago
#39442 new defect (bug)
Custom rewrite endpoints and wp_old_slug_redirect
Reported by: | 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.
Patch to include $id as a parameter