Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#48216 closed enhancement (duplicate)

Option to disable/bypass/shortcircuit redirect_guess_404_permalink

Reported by: apedog Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Canonical Keywords:
Focuses: Cc:


The redirect_canonical filter is useful for most cases. But its implementation is quirky and can lead to some unexpected results. One of its most annoying quirks is the redirect_guess_404_permalink implementation.

For example, when a cpt and attachment have the same (or similar) slug. mysite.com/a_slug will redirect to mysite.com/a_post/a_slug-2 (attachment page) instead of mysite.com/cpt/a_slug when both exist.

Could WordPress add an option to diable/filter/short-circuit only the auto-guess while still leaving all the ?p=123 => pretty permalink redirects in place.

Ideally it would be nice to have a settings page to fiddle with the redirect canonical options. ie. never redirect to an attachment page, or a more robust auto-guess function that prefers the actual slug over similar slugs or have the auto-guess prefer posts over attachments, etc. But a simple disable of the auto-guess seems like it can be implemented quite easily.

Change History (1)

#1 @SergeyBiryukov
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome to WordPress Trac!

Thanks for the ticket, we're already tracking this enhancement in #16557.

Note: See TracTickets for help on using tickets.