From 9275c8719009b994f5a29d3b83fa49d48b30c807 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 28 Jun 2014 04:27:15 +0000 Subject: [PATCH] `remove_all_filters()` should set to `array()`, not call `unset()`. Props nacin, c3mdigital. Fixes #19306. Built from https://develop.svn.wordpress.org/trunk@28883 git-svn-id: http://core.svn.wordpress.org/trunk@28682 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/plugin.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 7eba1bbdb6..610963aabf 100644 --- a/wp-includes/plugin.php +++ b/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; }