do_action_ref_array
函数
do_action_ref_array ( $hook_name, $args )
- 参数
-
-
(string)
$hook_name
The name of the action to be executed.- Required: 是
-
(array)
$args
The arguments supplied to the functions hooked to `$hook_name`.- Required: 是
-
(string)
- 相关
-
- do_action()
- 定义位置
-
-
wp-includes/plugin.php
, line 537
-
wp-includes/plugin.php
- 引入
- 2.1.0
- 弃用
- –
Calls the callback functions that have been added to an action hook, specifying arguments in an array.
function do_action_ref_array( $hook_name, $args ) {
global $wp_filter, $wp_actions, $wp_current_filter;
if ( ! isset( $wp_actions[ $hook_name ] ) ) {
$wp_actions[ $hook_name ] = 1;
} else {
++$wp_actions[ $hook_name ];
}
// Do 'all' actions first.
if ( isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $hook_name;
$all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
_wp_call_all_hook( $all_args );
}
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
if ( isset( $wp_filter['all'] ) ) {
array_pop( $wp_current_filter );
}
return;
}
if ( ! isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $hook_name;
}
$wp_filter[ $hook_name ]->do_action( $args );
array_pop( $wp_current_filter );
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。