From 209666d332db3fd2298bba31d9f52d6bb2f9f799 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 15 Sep 2019 12:03:04 +0000 Subject: [PATCH] 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 --- src/wp-includes/plugin.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php index 3621f4c5ce..3e021bbdd8 100644 --- a/src/wp-includes/plugin.php +++ b/src/wp-includes/plugin.php @@ -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 );