WordPress.org

Make WordPress Core

Changeset 28884


Ignore:
Timestamp:
06/28/2014 04:37:47 AM (7 years ago)
Author:
wonderboymusic
Message:

After [28883], remove_filter() should set $GLOBALS['wp_filter'][ $tag ] to array() when empty.

Props wonderboymusic, sphoid.
Fixes #28142.

File:
1 edited

Legend:

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

    r28883 r28884  
    274274 */
    275275function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
    276     $function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
    277 
    278     $r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
    279 
    280     if ( true === $r) {
    281         unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
    282         if ( empty($GLOBALS['wp_filter'][$tag][$priority]) )
    283             unset($GLOBALS['wp_filter'][$tag][$priority]);
    284         unset($GLOBALS['merged_filters'][$tag]);
     276    $function_to_remove = _wp_filter_build_unique_id( $tag, $function_to_remove, $priority );
     277
     278    $r = isset( $GLOBALS['wp_filter'][ $tag ][ $priority ][ $function_to_remove ] );
     279
     280    if ( true === $r ) {
     281        unset( $GLOBALS['wp_filter'][ $tag ][ $priority ][ $function_to_remove ] );
     282        if ( empty( $GLOBALS['wp_filter'][ $tag ][ $priority ] ) ) {
     283            unset( $GLOBALS['wp_filter'][ $tag ][ $priority ] );
     284        }
     285        if ( empty( $GLOBALS['wp_filter'][ $tag ] ) ) {
     286            $GLOBALS['wp_filter'][ $tag ] = array();
     287        }
     288        unset( $GLOBALS['merged_filters'][ $tag ] );
    285289    }
    286290
Note: See TracChangeset for help on using the changeset viewer.