diff --git a/src/wp-includes/class-wp-hook.php b/src/wp-includes/class-wp-hook.php
index 432a01600f..03119724f1 100644
a
|
b
|
final class WP_Hook implements Iterator, ArrayAccess { |
71 | 71 | * @param int $accepted_args The number of arguments the function accepts. |
72 | 72 | */ |
73 | 73 | public function add_filter( $hook_name, $callback, $priority, $accepted_args ) { |
| 74 | |
| 75 | $hook_name = trim( $hook_name ); |
| 76 | |
74 | 77 | $idx = _wp_filter_build_unique_id( $hook_name, $callback, $priority ); |
75 | 78 | |
76 | 79 | $priority_existed = isset( $this->callbacks[ $priority ] ); |
diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php
index 5f4fa15986..4f6988be74 100644
a
|
b
|
if ( ! isset( $wp_current_filter ) ) { |
114 | 114 | function add_filter( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { |
115 | 115 | global $wp_filter; |
116 | 116 | |
| 117 | $hook_name = trim( $hook_name ); |
| 118 | |
117 | 119 | if ( ! isset( $wp_filter[ $hook_name ] ) ) { |
118 | 120 | $wp_filter[ $hook_name ] = new WP_Hook(); |
119 | 121 | } |