Make WordPress Core


Ignore:
Timestamp:
06/28/2014 04:26:49 AM (10 years ago)
Author:
wonderboymusic
Message:

remove_all_filters() should set to array(), not call unset().

Props nacin, c3mdigital.
Fixes #19306.

File:
1 edited

Legend:

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

    r28011 r28883  
    297297 * @return bool True when finished.
    298298 */
    299 function remove_all_filters($tag, $priority = false) {
     299function remove_all_filters( $tag, $priority = false ) {
    300300    global $wp_filter, $merged_filters;
    301301
    302     if( isset($wp_filter[$tag]) ) {
    303         if( false !== $priority && isset($wp_filter[$tag][$priority]) )
    304             unset($wp_filter[$tag][$priority]);
    305         else
    306             unset($wp_filter[$tag]);
    307     }
    308 
    309     if( isset($merged_filters[$tag]) )
    310         unset($merged_filters[$tag]);
     302    if ( isset( $wp_filter[ $tag ]) ) {
     303        if ( false !== $priority && isset( $wp_filter[ $tag ][ $priority ] ) ) {
     304            $wp_filter[ $tag ][ $priority ] = array();
     305        } else {
     306            $wp_filter[ $tag ] = array();
     307        }
     308    }
     309
     310    if ( isset( $merged_filters[ $tag ] ) ) {
     311        unset( $merged_filters[ $tag ] );
     312    }
    311313
    312314    return true;
Note: See TracChangeset for help on using the changeset viewer.