do_action_ref_array( string $hook_name, array $args )
Calls the callback functions that have been added to an action hook, specifying arguments in an array.
Description
See also
do_action(): This function is identical, but the arguments passed to the functions hooked to
$hook_name
are supplied using an array.
Parameters
- $hook_name
-
(Required) The name of the action to be executed.
- $args
-
(Required) The arguments supplied to the functions hooked to
$hook_name
.
Source
File: wp-includes/plugin.php
function do_action_ref_array($tag, $args) {
global $wp_filter, $wp_actions, $wp_current_filter;
if ( ! isset($wp_actions[$tag]) )
$wp_actions[$tag] = 1;
else
++$wp_actions[$tag];
// Do 'all' actions first
if ( isset($wp_filter['all']) ) {
$wp_current_filter[] = $tag;
$all_args = func_get_args();
_wp_call_all_hook($all_args);
}
if ( !isset($wp_filter[$tag]) ) {
if ( isset($wp_filter['all']) )
array_pop($wp_current_filter);
return;
}
if ( !isset($wp_filter['all']) )
$wp_current_filter[] = $tag;
$wp_filter[ $tag ]->do_action( $args );
array_pop($wp_current_filter);
}
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |