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
|
b
|
function has_filter( $tag, $function_to_check = false ) { |
| 181 | 181 | function apply_filters( $tag, $value ) { |
| 182 | 182 | global $wp_filter, $wp_current_filter; |
| 183 | 183 | |
| 184 | | $args = array(); |
| | 184 | $args = func_get_args(); |
| 185 | 185 | |
| 186 | 186 | // Do 'all' actions first. |
| 187 | 187 | if ( isset( $wp_filter['all'] ) ) { |
| 188 | 188 | $wp_current_filter[] = $tag; |
| 189 | | $args = func_get_args(); |
| 190 | 189 | _wp_call_all_hook( $args ); |
| 191 | 190 | } |
| 192 | 191 | |
| … |
… |
function apply_filters( $tag, $value ) { |
| 201 | 200 | $wp_current_filter[] = $tag; |
| 202 | 201 | } |
| 203 | 202 | |
| 204 | | if ( empty( $args ) ) { |
| 205 | | $args = func_get_args(); |
| 206 | | } |
| 207 | | |
| 208 | | // don't pass the tag name to WP_Hook |
| | 203 | // Don't pass the tag name to WP_Hook. |
| 209 | 204 | array_shift( $args ); |
| 210 | 205 | |
| 211 | 206 | $filtered = $wp_filter[ $tag ]->apply_filters( $value, $args ); |