[wp-trac] [WordPress Trac] #39442: Custom rewrite endpoints and wp_old_slug_redirect

WordPress Trac noreply at wordpress.org
Tue Jan 3 00:21:08 UTC 2017


#39442: Custom rewrite endpoints and wp_old_slug_redirect
---------------------------+-----------------------------
 Reporter:  batmoo         |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:  4.7
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39442>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list