function unregister_problem_widgets() {
unregister_sidebar_widget('Calendar');
unregister_sidebar_widget('Search');
}
add_action('widgets_init','unregister_problem_widgets');
Widgets plugin has its own action hook for this sort of thing, called “widgets_init”. It happens just after the Widgets plugin registers all its own widgets.
An inferior solution:
function unregister_them() {
unregister_sidebar_widget('Calendar');
unregister_sidebar_widget('Search');
}
add_action('init','unregister_them',10);
The trick is unregistering them after the widgets plugin registers them. Since it registers them using the ‘init’ action hook at priority 5.
Advertisement

3 Comments
Great post Hone!
Thanks!!
This isn’t working for me. I’m using WP 2.8.2. Is there something new? I’ve tried all sorts of solutions about the internet, just like this one, and IT WON’T WORK. I’ve got it working before, I know, I remember.
I sincerely apologise for three comments now, but I feel I should point anyone else in my situation in the direction of http://wordpress.org/support/topic/281962?replies=2 Things are slightly different as of WordPress 2.8. It took me ages to figure it out.