Wordpress plugin.php有一个内部函数
function _wp_call_all_hook($args) {
global $wp_filter;
reset( $wp_filter['all'] );
do {
foreach( (array) current($wp_filter['all']) as $the_ )
if ( !is_null($the_['function']) )
call_user_func_array($the_['function'], $args);
} while ( next($wp_filter['all']) !== false );
}
我不理解以上面写的方式编写代码的必要性。如果它更简单地写成
,可能会出现什么问题function _wp_call_all_hook($args) {
global $wp_filter;
foreach($wp_filter['all'] as $the_ )
if ( !is_null($the_['function']) )
call_user_func_array($the_['function'], $args);
}
}