From 4fbd3a712a7d90fe80379f000dea6c7a39bba9ff Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 17 Apr 2009 20:45:33 +0000 Subject: [PATCH] Fix unregister_widget(). see #8441 git-svn-id: https://develop.svn.wordpress.org/trunk@10991 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/widgets.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index ab6e24ac40..5ee1761fc5 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -290,15 +290,12 @@ class WP_Widget_Factory { } function register($widget_class) { - $this->widgets[] = new $widget_class(); + $this->widgets[$widget_class] = new $widget_class(); } function unregister($widget_class) { - $offset = array_search($widget_class, $this->widgets); - if ( false === $offset ) - return; - - array_splice($this->widgets, $offset, 1); + if ( isset($this->widgets[$widget_class]) ) + unset($this->widgets[$widget_class]); } function _register_widgets() {