wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Unregister default widgets

wordpress snippet

Adding this to the functions.php of your wordpress theme will unregister the default wordpress widgets. Pick and choose what widgets you wish to unregister or all of them if you wish.

snippet :  PHPcopy
// 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');
    unregister_widget('WP_Nav_Menu_Widget');
}
add_action('widgets_init', 'unregister_default_wp_widgets', 1);

Did you like this post? If so please share it with your friends. Thanks!

  • http://matt-hall.co.uk Matt Hall

    unregister_widget(‘WP_Nav_Menu_Widget’); 

    That will remove the new nav menu widget.

    • http://wpsnipp.com Kevin Chard

      Nice call Matt, forgot that one. Nice blog by the way.

  • bigtreat

    Is there any way to unregister custom widgets ?