Skip to content

Instantly share code, notes, and snippets.

@tahirtaous
Created January 11, 2015 19:18
Show Gist options
  • Save tahirtaous/7ea914d60c900d5eeb58 to your computer and use it in GitHub Desktop.
Save tahirtaous/7ea914d60c900d5eeb58 to your computer and use it in GitHub Desktop.
WordPress has many default widgets such as recent post, calendar, meta, pages, rss and others, you can delete all widgets with this function. Add this to your functions.php file
// Source : http://wordpress.stackexchange.com/questions/1567/best-collection-of-code-for-your-functions-php-file
// 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment