If widget ID not found, scan the entire registered widgets array looking for legacy IDs. Props Denis-de-Bernardy. fixes #6605 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@7736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-04-18 02:19:45 +00:00
parent 019e456c4c
commit 926754275c
1 changed files with 18 additions and 0 deletions

View File

@ -306,6 +306,24 @@ function wp_get_sidebars_widgets($update = true) {
$_sidebars_widgets[$index][$i] = $id; $_sidebars_widgets[$index][$i] = $id;
continue; continue;
} }
$found = false;
foreach ( $wp_registered_widgets as $widget_id => $widget ) {
if ( strtolower($widget['name']) == strtolower($name) ) {
$_sidebars_widgets[$index][$i] = $widget['id'];
$found = true;
break;
} elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) {
$_sidebars_widgets[$index][$i] = $widget['id'];
$found = true;
break;
}
}
if ( $found )
continue;
unset($_sidebars_widgets[$index][$i]); unset($_sidebars_widgets[$index][$i]);
} }
$_sidebars_widgets['array_version'] = 2; $_sidebars_widgets['array_version'] = 2;