Fix unregister_widget(). see #8441

git-svn-id: http://svn.automattic.com/wordpress/trunk@10991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-17 20:45:33 +00:00
parent 05666ec7bc
commit bc7bcfbd79
1 changed files with 3 additions and 6 deletions

View File

@ -290,15 +290,12 @@ class WP_Widget_Factory {
} }
function register($widget_class) { function register($widget_class) {
$this->widgets[] = new $widget_class(); $this->widgets[$widget_class] = new $widget_class();
} }
function unregister($widget_class) { function unregister($widget_class) {
$offset = array_search($widget_class, $this->widgets); if ( isset($this->widgets[$widget_class]) )
if ( false === $offset ) unset($this->widgets[$widget_class]);
return;
array_splice($this->widgets, $offset, 1);
} }
function _register_widgets() { function _register_widgets() {