Remove Unused Default Widgets
Unregisters rarely used classic widgets (Meta, Calendar, RSS, Tag Cloud, Pages and Recent Comments) to declutter the widget list.
Opens WPIDE on
Code
add_action( 'widgets_init', function () {
// Delete a line to keep that widget.
$widgets = array(
'WP_Widget_Meta',
'WP_Widget_Calendar',
'WP_Widget_RSS',
'WP_Widget_Tag_Cloud',
'WP_Widget_Pages',
'WP_Widget_Recent_Comments',
);
foreach ( $widgets as $widget ) {
unregister_widget( $widget );
}
}, 11 );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.