6

I am using Multi-site installation. I don't want all the widgets to appear under widgets.php on the dashboard. So I tried to find a way to remove or hide unnecessary widgets. So that the new sub-sites created under my Multi-site won't have many widgets. That way the users won't get confused with a lot of widgets.

I tried to find the files related to widgets. But I was unable to find such pages in both wp-admin/includes/widgets.php and wp-admin/widgets.php.

I also tried to find in the theme files, but failed. Could anyone help me finding these?

Or do I have a chance to hide them using functions.php?

1 Answer 1

7

Add this to your functions.php file:

function jpb_unregister_widgets(){
  unregister_widget('WP_Widget_Pages');
  unregister_widget('WP_Widget_Calendar');
  unregister_widget('WP_Widget_Archives');
  unregister_widget('WP_Widget_Links');
  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');
  unregister_widget('WP_Nav_Menu_Widget');
}

add_action( 'widgets_init', 'jpb_unregister_widgets' );

This will get rid of all default widgets. If you want to keep a certain widget, remove that line from the function above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.