[wp-trac] [WordPress Trac] #12400: Add a wp_loaded hook, an ob_start hook, and an front end ajax hook

WordPress Trac wp-trac at lists.automattic.com
Sat Feb 27 14:19:01 UTC 2010


#12400: Add a wp_loaded hook, an ob_start hook, and an front end ajax hook
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:                        
     Type:  feature request    |      Status:  new                   
 Priority:  normal             |   Milestone:  3.0                   
Component:  General            |     Version:  3.0                   
 Severity:  normal             |    Keywords:  dev-feedback has-patch
-------------------------------+--------------------------------------------

Comment(by Denis-de-Bernardy):

 Replying to [comment:4 dd32]:
 > >  But i dont think we need to do the admin includes
 >
 > Ah, I see you've used the same Ajax actions for admin & front end.
 >
 > I'm not too sure thats a good idea myself. A front end ajax handler
 should be just that, a front end ajax hander, theres no real point having
 multiple entry points into the same actions.

 I'm fine with the idea of making new hooks, personally. As long as
 *something* gets checked into WP 3.0 that makes it clear to plugin authors
 where they should be hooking ajax handlers.

 The difference between init @ 1000 and wp_loaded, would be the same as the
 difference between, say, wp_headers and send_headers; or between request,
 and parse_request. It goes down to semantics: on the one hand side, you're
 "doing". On the other you're "done" - with no chance of seeing escalation
 races.

 A functionality on the template_redirect hook might make the example more
 clear. Suppose you've a plugin that starts an output buffer on
 template_redirect. You'll make the hook start very early (e.g. -1000). The
 last thing you want is users who complain that your plugin isn't
 compatible with XYZ, only to note that XYZ is using the same hook as you
 are, and happens to doing its stuff, then die, before the
 template_redirect hook is fully executed.

 The same goes here on the init hook. There are cases where you want to do
 something once WP is loaded, but the lack of a second hook is so that
 you'll occasionally see a plugin finish initializing itself *after*
 another plugin has decided that "it's my go, time to do something and
 die". Having a second hook around would make the first hook about
 instantiation, without action; the second would be about "at this point,
 everything that needs to be initialized is initialized; do stuff and die
 at will".

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12400#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list