Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This code removes all the default widgets from WordPress. You can also modify this code to keep the default widgets you want to use and delete the remainder.
function unregister_widgets() {
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
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_widgets', 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment