Title: CSS code to hide category is not working
Last modified: November 10, 2021

---

# CSS code to hide category is not working

 *  Resolved [Lori Boone](https://wordpress.org/support/users/pleazo/)
 * (@pleazo)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/)
 * Hello,
 * I was hoping someone could help me with a css code.
 * I am trying to remove “membership plan” from product the drop down filter when
   searching for all categories. This subscription plan should not be visible to
   users/shoppers. Only the shopping categories should show here.
 * I was given the following code (however it is not working):
    .woocommerce.widget_product_categories#
   product_cat [value=”membership-plan”]{ display: none !important; }
 * (as you can see [here](https://app.usebubbles.com/vFsoBNcM2RwXJQGarmghJq/comments-on-pleazo-com))
 * Does anyone know why this code does not work?
 * Best,
    Chris
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcss-code-to-hide-category-is-not-working%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [MayKato](https://wordpress.org/support/users/maykato/)
 * (@maykato)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15055674)
 * Hello,
 * You can try the following code to exclude a specific category from the category
   widget dropdown:
 *     ```
       add_filter( 'woocommerce_product_categories_widget_dropdown_args', 'woo_product_cat_widget_args' );
       function woo_product_cat_widget_args( $cat_args ) {
                       $cat_args['exclude'] = array('10'); // Insert the product category IDs you wish to exclude
                       return $cat_args;
       }
       ```
   
 * [[Code Source]](https://www.engagewp.com/remove-categories-woocommerce-product-category-widget/)
 * I would recommend using a plugin like [Code Snippets](https://wordpress.org/plugins/code-snippets/)
   to add the snippet to your site.
    -  This reply was modified 4 years, 6 months ago by [MayKato](https://wordpress.org/support/users/maykato/).
 *  Thread Starter [Lori Boone](https://wordpress.org/support/users/pleazo/)
 * (@pleazo)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15057964)
 * Hi [@maykato](https://wordpress.org/support/users/maykato/)
 * I tried the code (product category ID is 162) but still not working and the code
   shows up red when entered:
 *     ```
       add_filter( 'woocommerce_product_categories_widget_dropdown_args', 'woo_product_cat_widget_args' );
       function woo_product_cat_widget_args( $cat_args ) {
                       $cat_args['exclude'] = array('10'); // 162
                       return $cat_args;
       }
       ```
   
 * Any idea what I am doing wrong?
 * Best,
    Chris
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15060529)
 * Hi [@pleazo](https://wordpress.org/support/users/pleazo/),
 * If your product category ID is 162 you may want to use this snippet:
 *     ```
       add_filter( 'woocommerce_product_categories_widget_dropdown_args', 'woo_product_cat_widget_args' );
       function woo_product_cat_widget_args( $cat_args ) {
                       $cat_args['exclude'] = array('162'); // Insert the product category IDs you wish to exclude
                       return $cat_args;
       }
       ```
   
 * To avoid creating problems for anyone who is trying to help here, please add `
   NSFW` to the topic title of the post. As per the [forum guidelines](https://wordpress.org/support/guidelines/#warn-about-adult-content),
   this can be used when the content on the site is not suitable for a general audience
   or for viewing while at work.
 * If you’re not able to update it you can get assistance from a moderator using
   the options on the right to report the topic.
 * Cheers.
 *  Thread Starter [Lori Boone](https://wordpress.org/support/users/pleazo/)
 * (@pleazo)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15061113)
 * Hi [@rainfallnixfig](https://wordpress.org/support/users/rainfallnixfig/)
 * Thanks for your response. Unfortunately, this code is not working.
    Some of the
   code is red (as seen [here](https://snipboard.io/wiBzGZ.jpg)). This means there’s
   a problem with the code?
 * I will set NSFW next time.
 * Best.
    Chris
 *  [Abiola Ogodo](https://wordpress.org/support/users/oaoyadeyi/)
 * (@oaoyadeyi)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15063300)
 * [@pleazo](https://wordpress.org/support/users/pleazo/)
 * Kindly confirm if you’re adding the code using CSS customization or the code 
   snippets plugin recommended above. Kindly note the latter is required in this
   case.
    -  This reply was modified 4 years, 6 months ago by [Abiola Ogodo](https://wordpress.org/support/users/oaoyadeyi/).
    -  This reply was modified 4 years, 6 months ago by [Abiola Ogodo](https://wordpress.org/support/users/oaoyadeyi/).
 *  Thread Starter [Lori Boone](https://wordpress.org/support/users/pleazo/)
 * (@pleazo)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15072681)
 * Hi [@oaoyadeyi](https://wordpress.org/support/users/oaoyadeyi/)
    I am using the
   CSS customization.
 * Best,
    Chris
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15075466)
 * Hi Chris [@pleazo](https://wordpress.org/support/users/pleazo/)
 * This is actually a PHP snippet so we recommend using a plugin like [Code Snippets ](https://wordpress.org/plugins/code-snippets/)
   to add custom PHP code into your site without directly accessing the functions.
   php file.
 * Here is a link on how to use the Code Snippets plugin:
 * [https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/](https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/)
 * Hope this helps!
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15098024)
 * Hi there,
 * We haven’t heard from you in a while, so I’m going to mark this as resolved. 
   Feel free to start a new thread if you have any more questions.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘CSS code to hide category is not working’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)

 * 8 replies
 * 4 participants
 * Last reply from: [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/css-code-to-hide-category-is-not-working/#post-15098024)
 * Status: resolved