[wp-trac] [WordPress Trac] #11312: Add 'handle_404' hook to allow plugins to route URLs

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 8 13:32:33 UTC 2010

#11312: Add 'handle_404' hook to allow plugins to route URLs
 Reporter:  mikeschinkel              |        Owner:  ryan    
     Type:  enhancement               |       Status:  reopened
 Priority:  normal                    |    Milestone:          
Component:  Rewrite Rules             |      Version:          
 Severity:  normal                    |   Resolution:          
 Keywords:  needs-patch dev-feedback  |  

Comment(by filosofo):

 simonwheatley, I agree that we could really use more control over what
 happens in the `WP` objects's `main` method, but I don't think this patch
 is the way to go. It's somewhat arbitrary and not for the most part how
 filters are used in WordPress.

 Better would be something that provided general access to what's going on
 in `$wp`.  My inchoate idea is to separate `$wp`'s methods that set state
 from those that act on that state.

 Currently, it's a jumbled mix: `handle_404` both controls state ("let's
 see...looks like a 404 situation, so let's toggle `$wp_query`'s 404
 property to `true`") and acts on the state by printing headers.  Instead,
 one method should determine the current state, and another (with a filter
 or pass-by-reference action hook at the top) should do the header
 printing.  Then we could hold off on the headers until much closer to the
 time the templates get included and print them all at once.

Ticket URL: <http://core.trac.wordpress.org/ticket/11312#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list