WordPress.org

Make WordPress Core

Changeset 10991


Ignore:
Timestamp:
04/17/2009 08:45:33 PM (9 years ago)
Author:
ryan
Message:

Fix unregister_widget(). see #8441

File:
1 edited

Legend:

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

    r10979 r10991  
    291291
    292292    function register($widget_class) {
    293         $this->widgets[] = new $widget_class();
     293        $this->widgets[$widget_class] = new $widget_class();
    294294    }
    295295
    296296    function unregister($widget_class) {
    297         $offset = array_search($widget_class, $this->widgets);
    298         if ( false === $offset )
    299             return;
    300 
    301         array_splice($this->widgets, $offset, 1);
     297        if ( isset($this->widgets[$widget_class]) )
     298            unset($this->widgets[$widget_class]);
    302299    }
    303300
Note: See TracChangeset for help on using the changeset viewer.