[wp-trac] [WordPress Trac] #14994: Introduce a way to identify a hook in progress

WordPress Trac noreply at wordpress.org
Wed Feb 26 18:44:00 UTC 2014


#14994: Introduce a way to identify a hook in progress
------------------------------------------+---------------------
 Reporter:  nacin                         |       Owner:  nacin
     Type:  enhancement                   |      Status:  closed
 Priority:  normal                        |   Milestone:  3.9
Component:  Plugins                       |     Version:
 Severity:  normal                        |  Resolution:  fixed
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+---------------------
Changes (by nacin):

 * owner:   => nacin
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"27294"]:
 {{{
 #!CommitTicketReference repository="" revision="27294"
 Introduce doing_filter() and doing_action() to identify hooks in progress.

 did_action() returns true the moment a hook is initially run, leaving you
 no way to tell if the hook is still in progress. Hooks can be nested and
 this checks the entire stack, versus current_filter() which only
 identifies the final hook in the stack. This commit also introduces
 current_action() for parity.

 To tell if a hook has completed, one can use did_action() and !
 doing_action() together.

 The functions do not require an argument. In that situation, they indicate
 whether the stack is empty.

 props ericmann for the initial unit tests.
 fixes #14994.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/14994#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list