Opened 12 years ago
Closed 12 years ago
#21978 closed enhancement (duplicate)
Introduce an action before 404 headers are sent
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.2 |
Component: | Query | Keywords: | has-patch |
Focuses: | Cc: |
Description
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.
Duplicate of #10722, also of #11312.