Skip to content

Instantly share code, notes, and snippets.

@deeman
Created August 9, 2018 11:10
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 deeman/9f3f8ece3409e3b88fafb9d72a1f8a25 to your computer and use it in GitHub Desktop.
Save deeman/9f3f8ece3409e3b88fafb9d72a1f8a25 to your computer and use it in GitHub Desktop.
Unregister Widget Areas in Admin
/*
* Comment out the ones you want to keep. You will need some, but not all, for each project.
* Also, if you un-register then you can't use the_widget();
*/
add_action( 'widgets_init', 'cab_unregister_widgets', 10 );
/**
* Unregister Various Widgets
* Clean up your widgets.php page
* Single comment out the ones you want to keep
*/
function cab_unregister_widgets() {
$unregister_widgets = array(
'WP_Widget_Calendar',
'WP_Widget_Archives',
'WP_Widget_Tag_Cloud',
'WP_Widget_Media_Audio',
'WP_Widget_Media_Video',
'WP_Widget_Media_Image',
'WP_Widget_Media_Gallery',
'WP_Widget_Meta',
'WP_Widget_Categories',
'WP_Widget_Recent_Posts',
'WP_Widget_Recent_Comments',
'WP_Widget_RSS',
'WP_Widget_Pages',
'WP_Widget_Custom_HTML',
'WP_Nav_Menu_Widget',
'WP_Widget_Text',
'WP_Widget_Search',
// * --- Genesis ---
'Genesis_Featured_Page',
'Genesis_Featured_Posts',
'Genesis_User_Profile_Widget',
// * --- WooCommerce ---
'WC_Widget_Layered_Nav_Filters',
'WC_Widget_Cart',
'WC_Widget_Layered_Nav',
'WC_Widget_Price_Filter',
'WC_Widget_Product_Categories',
'WC_Widget_Product_Tag_Cloud',
'WC_Widget_Products',
'WC_Widget_Rating_Filter',
'WC_Widget_Recent_Reviews',
'WC_Widget_Recently_Viewed',
'WC_Widget_Top_Rated_Products',
'WC_Widget_Product_Search',
);
foreach($unregister_widgets as $w):
unregister_widget($w);
endforeach;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment