From bc7bcfbd794d2d6470b3b758436cb3f4adb9d490 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 17 Apr 2009 20:45:33 +0000 Subject: [PATCH] Fix unregister_widget(). see #8441 git-svn-id: http://svn.automattic.com/wordpress/trunk@10991 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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() {