diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 76ea10a4e0..c2bc9123ad 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -138,6 +138,11 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) function do_action($tag, $arg = '') { global $wp_filter, $wp_actions; + if ( is_array($wp_actions) ) + $wp_actions[] = $tag; + else + $wp_actions = array($tag); + $args = array(); if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this) $args[] =& $arg[0]; @@ -158,16 +163,12 @@ function do_action($tag, $arg = '') { } while ( next($wp_filter[$tag]) ); - if ( is_array($wp_actions) ) - $wp_actions[] = $tag; - else - $wp_actions = array($tag); } /** - * Return the number of functions hooked to a specific action hook. + * Return the number times an action is fired. * @param string $tag The name of the action hook. - * @return int The number of functions hooked to action hook $tag + * @return int The number of times action hook $tag is fired */ function did_action($tag) { global $wp_actions;