Skip to content

Instantly share code, notes, and snippets.

@paaljoachim
Created August 20, 2015 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paaljoachim/6d35995e72b2a43f8a76 to your computer and use it in GitHub Desktop.
Save paaljoachim/6d35995e72b2a43f8a76 to your computer and use it in GitHub Desktop.
The code snippet added to the functions.php file will remove the default WordPress widgets. I have commented the widgets I do not want to remove.
/* The below code removes all the default WordPress widgets. I commeted the ones I do not want to remove. */
// 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');
}
add_action('widgets_init', 'unregister_default_widgets', 11);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment