Hello程序员
我的WordPress版本4.7有问题,最近我将我的网站WordPress平台更新为新版本,它在我的网站主页上给我一个警告信息。这是警告信息:
警告:call_user_func_array()期望参数1有效 回调,没有给出的数组或字符串 /home/kvlkclir/english.kvlkcl.ir/wp-includes/class-wp-hook.php上线 298
以下是指出的地方:
if ( $the_['accepted_args'] == 0 ) {
$value = call_user_func_array( $the_['function'], array() );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args);
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );
}
我看到php.net并且因为php 5.3中的 call_user_func_array 语法而弄明白它(我使用的是php 5.3)。我对php有一点了解,因此如果有人可以告诉我应该怎么做,我无法修复我的网站上的警告。我很欣赏它。
谢谢
以下是整个代码:
public function apply_filters( $value, $args ) {
if ( ! $this->callbacks ) {
return $value;
}
$nesting_level = $this->nesting_level++;
$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
$num_args = count( $args );
do {
$this->current_priority[ $nesting_level ] = $priority = current( $this->iterations[ $nesting_level ] );
foreach ( $this->callbacks[ $priority ] as $the_ ) {
if( ! $this->doing_action ) {
$args[ 0 ] = $value;
}
if ( $the_['accepted_args'] == 0 ) {
$value = call_user_func_array( $the_['function'], array() );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args);
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );
}
}
} while ( false !== next( $this->iterations[ $nesting_level ] ) );
unset( $this->iterations[ $nesting_level ] );
unset( $this->current_priority[ $nesting_level ] );
$this->nesting_level--;
return $value;
}