Categories
WordPress

Default Sidebar Widgets in WordPress MU

The following plugin code, placed in the indicated directory, will set the default plugins for any MU blogs created after this plugin is installed. By examining the code you can see that sidebar-1 and sidebar-1 can be controlled separately.

If you don't wish to place anything by default in either of those two sidebars, simply omit any references to it.

/wp-content/mu-plugins/default-mu-sidebar.php

1
2
3
4
5
6
7
8
9
10
11
12
<!--?php 
function new_blogs_setting( $blog_id ) {
  add_option( 'widget_categories',array( 'title' =--> 'My Categories' ));
 
  add_option("sidebars_widgets",array(
    "sidebar-1" =&gt; array("categories","links"),
    "sidebar-2" =&gt; array("tag_cloud"),
    "sidebar-3" =&gt; array("pages"),
    "sidebar-4" =&gt; array("archives")));
}
add_action('populate_options', 'new_blogs_setting');
?&gt;