Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#21978 closed enhancement (duplicate)

Introduce an action before 404 headers are sent

Reported by: ethitter Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: Query Keywords: has-patch
Focuses: Cc:


Currently there are actions that fire after the requested URL is parsed, but none between when the parsed query arguments are attempted and the 404 header is sent. As a result, hooking in to redirect 404 requests must happen at parse_request, adding overhead where it often isn't needed. The attached patch introduces an action immediately before the 404 headers are sent.

This is useful for a variety of reasons, such as when a site migrates from a different CMS. If post slugs are maintained, WordPress handles the redirection, but special cases may exist where manual redirection is needed. By waiting until after WordPress has made its various attempts at locating the requested content, logic related to these redirects could be simplified, and the number of times this logic fires can be greatly reduced.

Attachments (1)

21978.patch (397 bytes) - added by ethitter 3 years ago.

Download all attachments as: .zip

Change History (2)

3 years ago

#1 @nacin
3 years ago

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

Duplicate of #10722, also of #11312.

Note: See TracTickets for help on using tickets.