Created
January 29, 2018 18:55
-
-
Save carasmo/1a2c3c11f58c99d30fbc2b0c015fce18 to your computer and use it in GitHub Desktop.
Un-register widgets and clean up the widgets page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Don't re-add the php tag | |
/* | |
* 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