From 4a326547bbff15c74fe6750299ec08a00a6dc80d Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Thu, 18 Jul 2019 06:27:32 +0200
Subject: [PATCH] Code simplification apply_filters()

---
 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 7c40389f90..a89c61be9e 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 );
-- 
2.21.0.windows.1

