Code Modernisation: Simplify some logic in apply_filters().

Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46146 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-15 12:03:04 +00:00
parent 802c23e059
commit 209666d332

View File

@ -181,12 +181,11 @@ function has_filter( $tag, $function_to_check = false ) {
function apply_filters( $tag, $value ) {
global $wp_filter, $wp_current_filter;
$args = array();
$args = func_get_args();
// Do 'all' actions first.
if ( isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag;
$args = func_get_args();
_wp_call_all_hook( $args );
}
@ -201,11 +200,7 @@ function apply_filters( $tag, $value ) {
$wp_current_filter[] = $tag;
}
if ( empty( $args ) ) {
$args = func_get_args();
}
// don't pass the tag name to WP_Hook
// Don't pass the tag name to WP_Hook.
array_shift( $args );
$filtered = $wp_filter[ $tag ]->apply_filters( $value, $args );