Skip to content

Instantly share code, notes, and snippets.

@carasmo
Last active March 24, 2021 13:36
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save carasmo/3466ceea21b7c70df3a027b0420aa6d9 to your computer and use it in GitHub Desktop.
Save carasmo/3466ceea21b7c70df3a027b0420aa6d9 to your computer and use it in GitHub Desktop.
Unregister WordPress, Genesis, and WooCommerce widgets Raw
<?php
//Don't copy above.
add_action('widgets_init', 'cabeymer_unregister_widgets', 10);
/**
* Unregister Various Widgets
* Clean up your widgets.php page
* Single comment out the ones you want to keep
*/
function cabeymer_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',
//* Keeping Core
//'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',
//* Keeping Woo
// 'WC_Widget_Product_Search',
//* --- Other Widgets added by plugins ---
);
foreach ($unregister_widgets as $w):
unregister_widget($w);
endforeach;
} //* end cabeymer_unregsister_widgets();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment