Snippet

How to Hide Unused Widgets in WooCommerce Admin Panel

How to hide unused widgets in woocommerceRemove unwanted widgets from woocommerce panelDisable woocommerce widgetsHide woocommerce dashboard widgetsRemove widgets from woocommerce adminHow to disable widgets in woocommerceWoocommerce hide unused widgetsRemove woocommerce sidebar widgetsDisable unused widgets in woocommerceHow to remove widgets from woocommerce

Explanation

If you're looking to tidy up your WooCommerce admin area by hiding widgets you don't use, this code will help you do just that.

Remove Dashboard Widgets:

  • This part of the code removes certain widgets from your WordPress admin dashboard. Widgets like WooCommerce Status, Recent Reviews, and Recent Orders will no longer clutter your view.

Unregister Sidebar Widgets:

  • The second function targets the widgets that appear in your site's sidebar. It unregisters a variety of WooCommerce widgets such as Recent Products, Featured Products, and Product Categories, among others.

By using this code, you can streamline your WooCommerce interface, making it easier to focus on the tools you actually use. Just add this snippet to your theme's functions.php file, and you'll have a cleaner, more efficient admin panel and sidebar.

Code

1<?php 2// Function to remove unused WooCommerce widgets from the WordPress admin dashboard 3function wp_dudecom_remove_woocommerce_dashboard_widgets() { 4 // Remove specific WooCommerce dashboard widgets 5 remove_meta_box('woocommerce_dashboard_status', 'dashboard', 'normal'); // WooCommerce Status 6 remove_meta_box('woocommerce_dashboard_recent_reviews', 'dashboard', 'normal'); // Recent Reviews 7 remove_meta_box('woocommerce_dashboard_recent_orders', 'dashboard', 'normal'); // Recent Orders 8} 9add_action('wp_dashboard_setup', 'wp_dudecom_remove_woocommerce_dashboard_widgets'); 10 11// Function to unregister unused WooCommerce widgets from the WordPress widgets panel 12function wp_dudecom_unregister_woocommerce_widgets() { 13 // Unregister specific WooCommerce widgets 14 unregister_widget('WC_Widget_Recent_Products'); 15 unregister_widget('WC_Widget_Featured_Products'); 16 unregister_widget('WC_Widget_Product_Categories'); 17 unregister_widget('WC_Widget_Product_Tag_Cloud'); 18 unregister_widget('WC_Widget_Cart'); 19 unregister_widget('WC_Widget_Layered_Nav'); 20 unregister_widget('WC_Widget_Layered_Nav_Filters'); 21 unregister_widget('WC_Widget_Price_Filter'); 22 unregister_widget('WC_Widget_Product_Search'); 23 unregister_widget('WC_Widget_Top_Rated_Products'); 24 unregister_widget('WC_Widget_Recent_Reviews'); 25 unregister_widget('WC_Widget_Best_Sellers'); 26 unregister_widget('WC_Widget_On_Sale'); 27 unregister_widget('WC_Widget_Random_Products'); 28} 29add_action('widgets_init', 'wp_dudecom_unregister_woocommerce_widgets', 15); 30?>

Instructions

File Location: Add the provided code to your theme's functions.php file or a custom plugin file.

Prerequisites:

  • Ensure WooCommerce is installed and activated on your WordPress site.

Implementation Steps:

  1. Log in to your WordPress admin dashboard.
  2. Navigate to Appearance > Theme File Editor if you are adding the code to functions.php. Alternatively, open your custom plugin file if you prefer to use a plugin.
  3. Locate and open the functions.php file from the list of theme files on the right side.
  4. Scroll to the bottom of the file and paste the provided code snippet.
  5. Click Update File to save your changes.
  6. Refresh your WordPress admin dashboard to see the changes. The specified WooCommerce widgets should no longer appear in the dashboard or sidebar.

By following these steps, you can effectively declutter your WooCommerce admin area, focusing only on the widgets you need. If you require assistance with this implementation or need more advanced functionality, consider reaching out to wp-dude.com for expert help.