The trick is unregistering them after the widgets plugin registers them. Since it registers them using the ‘init’ action hook at priority 5, the following will unregister them:
function unregister_them() {
unregister_sidebar_widget('Calendar');
unregister_sidebar_widget('Search');
}
add_action('init','unregister_them',10);
While that will indeed work, it’s not the best way. Relying on the priority is haphazard at best. Useful for a quick fix and such, but not really something you want to depend on.
A better way is to notice that the 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.
function unregister_problem_widgets() {
unregister_sidebar_widget('Calendar');
unregister_sidebar_widget('Search');
}
add_action('widgets_init','unregister_problem_widgets');
Thread Starter
Jeriko
(@jeriko)
Works like a charm, thank you so much
Thank you very much, same here. Works like charm.