How to Unregister the Default WordPress Widgets to Clean Up Your Dashboard

Widgets are one of the key features that makes WordPress so wonderfully easy to use. Everyone loves the convenience of drag and drop. WordPress comes packaged with 12 default widgets available for use. Add that to the widgets that you get from plugins and themes and you can really go overboard. Here’s an example:

And that’s only the available widgets – not including the inactive widgets.

This scenario happens to me quite frequently. I find myself saying, dang it, I know this plugin I just installed is supposed to be packaged with a widget, but I’m not sure which one it is among this vast sea of widgets! Many plugins often use similar names to the default widgets, so it can take some hunting, trial and error to figure out if you’ve got the right widget.

Let’s do a little cleanup…

If you’re not making use of many of the default widgets included with the WordPress core, here’s what you can do. Unregister them by copying and pasting this into your theme’s functions.php file:

{code type=php}
// unregister all default WP Widgets
function unregister_default_wp_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’);
}
add_action(‘widgets_init’, ‘unregister_default_wp_widgets’, 1);
{/code}

You don’t have to remove all of the default widgets if you don’t want to. If there are some in there that you plan on using, simply don’t include them in the code block. For example, let’s say you want to remove all the defaults except for the “Recent Posts” and “Recent Comments” widgets. Delete those lines from the code block and you’ll preserve those widgets. Don’t worry if you make a mistake – you can always bring them back.

A messy widget area isn’t necessarily a sign of untidiness, but if you like a clean work area, you’ll benefit from this little hack. It will take you about 1 minute to copy and paste and you’ll get instant cleanup.