Title: Problem with WP Query
Last modified: August 24, 2016

---

# Problem with WP Query

 *  [thisisbbc](https://wordpress.org/support/users/thisisbbc/)
 * (@thisisbbc)
 * [11 years ago](https://wordpress.org/support/topic/problem-with-wp-query-1/)
 * Hi,
 * We have some problem trying to rewrite WP Query to display only the products 
   we want. To be more specific, we’re trying to exclude an entire category. Our
   expression goes as follow :
 * post__not_in=array(184)&category__not_in=array(‘holidays’)
 * The product ID 184 is excluded from the list but the products in Holidays are
   still displayed. We’ve also tried to use the category ID without success.
 * Is there anything we’re doing wrong?
 * Regards,
    Bastien
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

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

 *  [vark](https://wordpress.org/support/users/vark/)
 * (@vark)
 * [11 years ago](https://wordpress.org/support/topic/problem-with-wp-query-1/#post-6135028)
 * You could try using the category id, not the name….
 * an interesting thread:
    [https://wordpress.org/support/topic/excluding-category-from-search-works-in-other-loops](https://wordpress.org/support/topic/excluding-category-from-search-works-in-other-loops)
 *  Thread Starter [thisisbbc](https://wordpress.org/support/users/thisisbbc/)
 * (@thisisbbc)
 * [11 years ago](https://wordpress.org/support/topic/problem-with-wp-query-1/#post-6135057)
 * We’ve tried with “category__not_in=30”, “category__not_in=array(30)” and quite
   a some other things but it’s still not working 🙁
 * For some reason we cannot filter the output of WooCommerce custom post type using
   these expressions…

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

The topic ‘Problem with WP Query’ 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

 * [display](https://wordpress.org/support/topic-tag/display/)
 * [list](https://wordpress.org/support/topic-tag/list/)
 * [products](https://wordpress.org/support/topic-tag/products/)
 * [regular expression](https://wordpress.org/support/topic-tag/regular-expression/)
 * [wp-query](https://wordpress.org/support/topic-tag/wp-query/)

 * 2 replies
 * 2 participants
 * Last reply from: [thisisbbc](https://wordpress.org/support/users/thisisbbc/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/problem-with-wp-query-1/#post-6135057)
 * Status: not resolved