From 8638b7ab3ad1739364f958b845d38439dcf3b99a Mon Sep 17 00:00:00 2001 From: rob1n Date: Fri, 4 May 2007 23:27:12 +0000 Subject: [PATCH] Return based on whether the hook was removed or not. Props mdawaffe. fixes #4223 Note that this will almost definitely *not* affect existing implementations. The way most code is set up now is to just call remove_filter() or remove_action(). git-svn-id: http://svn.automattic.com/wordpress/trunk@5393 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/plugin.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 386f3f5cd2..76ea10a4e0 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -97,12 +97,14 @@ function merge_filters($tag) { * @return boolean Whether the function is removed. */ function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { - global $wp_filter, $merged_filters; + $function_to_remove = serialize($function_to_remove); - unset($GLOBALS['wp_filter'][$tag][$priority][serialize($function_to_remove)]); - unset( $merged_filters[ $tag ] ); + $r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); - return true; + unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); + unset($GLOBALS['merged_filters'][$tag]); + + return $r; } /** @@ -216,7 +218,7 @@ function do_action_ref_array($tag, $args) { * @return boolean Whether the function is removed. */ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { - remove_filter($tag, $function_to_remove, $priority, $accepted_args); + return remove_filter($tag, $function_to_remove, $priority, $accepted_args); } // @@ -274,4 +276,4 @@ function register_deactivation_hook($file, $function) { add_action('deactivate_' . $file, $function); } -?> \ No newline at end of file +?>