From d88a14ee671097bf03468abd112e8f4b46b946c8 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 28 Jun 2014 04:26:49 +0000 Subject: [PATCH] `remove_all_filters()` should set to `array()`, not call `unset()`. Props nacin, c3mdigital. Fixes #19306. git-svn-id: https://develop.svn.wordpress.org/trunk@28883 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/plugin.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php index 7eba1bbdb6..610963aabf 100644 --- a/src/wp-includes/plugin.php +++ b/src/wp-includes/plugin.php @@ -296,18 +296,20 @@ function remove_filter( $tag, $function_to_remove, $priority = 10 ) { * @param int $priority The priority number to remove. * @return bool True when finished. */ -function remove_all_filters($tag, $priority = false) { +function remove_all_filters( $tag, $priority = false ) { global $wp_filter, $merged_filters; - if( isset($wp_filter[$tag]) ) { - if( false !== $priority && isset($wp_filter[$tag][$priority]) ) - unset($wp_filter[$tag][$priority]); - else - unset($wp_filter[$tag]); + if ( isset( $wp_filter[ $tag ]) ) { + if ( false !== $priority && isset( $wp_filter[ $tag ][ $priority ] ) ) { + $wp_filter[ $tag ][ $priority ] = array(); + } else { + $wp_filter[ $tag ] = array(); + } } - if( isset($merged_filters[$tag]) ) - unset($merged_filters[$tag]); + if ( isset( $merged_filters[ $tag ] ) ) { + unset( $merged_filters[ $tag ] ); + } return true; }