How Delete Default Widgets

 In Widgets

Hack: Remove Default Widgets

I have struggled to understand in how to use the WordPress’ calendar widget. It’s fair to say that many of us will never use plenty of the default widgets. So if you want them out of the way, just use the following code snippet:

// unregister all widgets
function unregister_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');
unregister_widget('Twenty_Eleven_Ephemera_Widget');
}
add_action('widgets_init', 'unregister_default_widgets', 11);

As you can probably guess, you can elect to keep any individual widget by simply deleting the line of code that references it.

Recommended Posts

Start typing and press Enter to search