Paulund
2012-05-06 #wordpress

How to Remove Default WordPress Widgets

By default Wordpress comes with a number of different in-built widgets which allow you to easily add additional functionality to your Wordpress theme. But if you have a custom made theme then most likely you will not be using any of these default Wordpress widgets. If your not going to be using the widget then it would be good to remove these completely from the widget dashboard. To remove these widgets just use the following function.


// unregister all widgets
 function remove_default_widgets() {
     unregister_widget('WP_Widget_Pages');
     unregister_widget('WP_Widget_Calendar');
     unregister_widget('WP_Widget_Archives');
     unregister_widget('WP_Widget_Links');
     unregister_widget('WP_Widget_Meta');
     unregister_widget('WP_Widget_Search');
     unregister_widget('WP_Widget_Text');
     unregister_widget('WP_Widget_Categories');
     unregister_widget('WP_Widget_Recent_Posts');
     unregister_widget('WP_Widget_Recent_Comments');
     unregister_widget('WP_Widget_RSS');
     unregister_widget('WP_Widget_Tag_Cloud');
     unregister_widget('WP_Nav_Menu_Widget');
 }
 add_action('widgets_init', 'remove_default_widgets', 11);

Remove Default Wordpress Widget Plugin

There is a plugin which was brought to my attention with a comment from http://kovshenin.com/ pointing me to a URL about his plugin to remove the default Wordpress widgets. This plugin does not remove the widgets as explained above this uses a much better, more efficient way of removing the default Wordpress widgets. This plugin does not use the function unregister_widget but it will block Wordpress from registering the widgets to start with. The benefit of this is that if new versions of Wordpress adds new default Widgets then you don't have to open up this snippet and add another unregister_widget function, it will automatically block the new widget. Download Remove Default Widgets Plugin The only problem with this plugin is that if you want to use any of the default widgets you will have to then go and register them manually. By doing the opposite to the above and register the widgets by using the register_widget() function. Now you have two ways of removing those default Widgets, just decide which one suits your needs best.