Opened 3 weeks ago
Custom rewrite endpoints and wp_old_slug_redirect
|Reported by:||batmoo||Owned by:|
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.