通过使用以下代码挂接wpmu\\u new\\u博客,手动解决了此问题:
global $wpdb;
$option_names = $wpdb->get_results("SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE \'widget_%\' OR option_name LIKE \'sidebars_%\';");
$widget_options = array();
foreach ($option_names as $option_name) {
$widget_options["$option_name->option_name"] = get_option($option_name->option_name);
}
switch_to_blog($blog_id);
delete_option( \'widget_search\', array ( 2 => array ( \'title\' => \'\' ), \'_multiwidget\' => 1 ) );
delete_option( \'widget_recent-posts\', array ( 2 => array ( \'title\' => \'\', \'number\' => 5 ), \'_multiwidget\' => 1 ) );
delete_option( \'widget_recent-comments\', array ( 2 => array ( \'title\' => \'\', \'number\' => 5 ), \'_multiwidget\' => 1 ) );
delete_option( \'widget_archives\', array ( 2 => array ( \'title\' => \'\', \'count\' => 0, \'dropdown\' => 0 ), \'_multiwidget\' => 1 ) );
delete_option( \'widget_categories\', array ( 2 => array ( \'title\' => \'\', \'count\' => 0, \'hierarchical\' => 0, \'dropdown\' => 0 ), \'_multiwidget\' => 1 ) );
delete_option( \'widget_meta\', array ( 2 => array ( \'title\' => \'\' ), \'_multiwidget\' => 1 ) );
foreach ($widget_options as $option_name => $option_value) {
update_option($option_name, $option_value);
}
restore_current_blog();
虽然不是世界上最好的代码,但我想它完成了任务。