Introduce an action before 404 headers are sent
|Reported by:||ethitter||Owned by:|
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.