'', 'id' => 'wp_inactive_widgets', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', )); // These are the widgets grouped by sidebar $sidebars_widgets = wp_get_sidebars_widgets(); if ( empty( $sidebars_widgets ) ) $sidebars_widgets = wp_get_widget_defaults(); // look for "lost" widgets, perhaps run only after changin themes function retrieve_widgets() { global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets; $key_sidebars = array_keys( (array) $wp_registered_sidebars); $key_widgets = array_keys($sidebars_widgets); if ( count($key_widgets) > count($key_sidebars) ) { $changed_sidebars = array_diff( $key_widgets, $key_sidebars ); foreach ( $changed_sidebars as $lost ) { if ( is_array($sidebars_widgets[$lost]) ) $sidebars_widgets['wp_inactive_widgets'] = array_merge( (array) $sidebars_widgets['wp_inactive_widgets'], $sidebars_widgets[$lost] ); unset($sidebars_widgets[$lost]); } } $shown_widgets = array(); foreach ( $sidebars_widgets as $sidebar ) { if ( is_array($sidebar) ) $shown_widgets = array_merge($shown_widgets, $sidebar); } $all_widgets = array(); foreach ( $wp_registered_widget_updates as $key => $val ) { if ( isset($val['id_base']) ) $all_widgets[] = $val['id_base']; else $all_widgets[] = $key; } $all_widgets = array_unique($all_widgets); $lost_widgets = array(); foreach ( $all_widgets as $name ) { $data = get_option( str_replace('-', '_', "widget_$name") ); if ( is_array($data) ) { foreach ( $data as $num => $value ) { if ( !is_numeric($num) ) // skip single widgets, some don't delete their settings continue; if ( is_array($value) && !in_array("$name-$num", $shown_widgets, true) ) $lost_widgets[] = "$name-$num"; } } } $sidebars_widgets['wp_inactive_widgets'] = array_merge($lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets']); wp_set_sidebars_widgets($sidebars_widgets); } retrieve_widgets(); if ( count($wp_registered_sidebars) == 1 ) { // If only the "wp_inactive_widgets" is defined the theme has no sidebars, die. require_once( 'admin-header.php' ); ?>

follow these instructions.' ); ?>

$widget_search ? __( 'Show any widgets' ) : __( 'Show all widgets' ), 'unused' => __( 'Show unused widgets' ), 'used' => __( 'Show used widgets' ) ); */ $show = isset($_GET['show']) && isset($show_values[$_GET['show']]) ? attribute_escape( $_GET['show'] ) : false; $messages = array( 'updated' => __('Changes saved.') ); require_once( 'admin-header.php' ); ?>

This page is not 100% ready, please use only on test installations.



$registered_sidebar ) { if ( 'wp_inactive_widgets' == $sidebar ) continue; ?>