[wp-hackers] widgets automatic instanciation

Raphaël Droz raphael.droz at gmail.com
Wed Apr 21 10:31:57 UTC 2010

After having spent a lot of time on the question I was finally able to 
automatically add widgets
at wpmu_create_blog() time
I would like to share the code to get some comments and to find why some 
widgets still fail
to be initialized.

I used the attached code with the following :
add_action('wpmu_new_blog', 'create_default_widgets');

Widget are created but some miss some information (title, checkbox) :
WP_Widget_Text, WP_Widget_Categories and WP_Widget_RSS.
All others are configured properly.

Paradoxally, when I call this function from, eg, index.php of the theme 
used by the site, all those 3 are
configured properly like other 5.

Hints welcome


More information about the wp-hackers mailing list