[wp-trac] [WordPress Trac] #23035: do_action() can't be nested because of global variable

WordPress Trac noreply at wordpress.org
Fri Dec 21 10:45:42 UTC 2012


#23035: do_action() can't be nested because of global variable
--------------------------+------------------------------
 Reporter:  cheeserolls   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Plugins       |     Version:  3.5
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------
Changes (by toscho):

 * cc: info@… (added)


Comment:

 > However, saving the duplicates, causes the 'save_post' action to be
 triggered again.

 But that’s a bug in the plugin code, not in WordPress. To avoid that just
 remove the action on the first call inside of the function body:


 {{{
 remove_action( current_filter(), __FUNCTION__ );
 }}}

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


More information about the wp-trac mailing list