WordPress.org

Make WordPress Core

Changeset 5393


Ignore:
Timestamp:
05/04/07 23:27:12 (8 years ago)
Author:
rob1n
Message:

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().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/plugin.php

    r5202 r5393  
    9898 */ 
    9999function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { 
    100     global $wp_filter, $merged_filters; 
    101  
    102     unset($GLOBALS['wp_filter'][$tag][$priority][serialize($function_to_remove)]); 
    103     unset( $merged_filters[ $tag ] ); 
    104  
    105     return true; 
     100    $function_to_remove = serialize($function_to_remove); 
     101 
     102    $r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); 
     103 
     104    unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); 
     105    unset($GLOBALS['merged_filters'][$tag]); 
     106 
     107    return $r; 
    106108} 
    107109 
     
    217219 */ 
    218220function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { 
    219     remove_filter($tag, $function_to_remove, $priority, $accepted_args); 
     221    return remove_filter($tag, $function_to_remove, $priority, $accepted_args); 
    220222} 
    221223 
Note: See TracChangeset for help on using the changeset viewer.