Title: Excluding Categories
Last modified: September 8, 2017

---

# Excluding Categories

 *  Resolved [ratterizzo](https://wordpress.org/support/users/ratterizzo/)
 * (@ratterizzo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/excluding-categories-13/)
 * Hi
 * Again a newbie question: I’d like to show all pix of an attachment_category. 
   Easy so far. But if a picture is also in a second category, it should not appear.
 * How to do that? I already did some tries with category_not_in but without success.
 * Cheers
    Daniel

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

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/excluding-categories-13/#post-9481080)
 * Thanks for your question. I have had success with this shortcode on my test system:
 *     ```
       [mla_gallery]
       tax_query="array(
           'relation' => 'AND',
           array(
               'taxonomy'=>'attachment_category',
               'field'=>'slug',
               'terms'=> array( 'new-category' ),
               'operator' => 'IN',
               ),
           array(
               'taxonomy'=>'attachment_category',
               'field'=>'slug',
               'terms'=> array( 'short' ),
               'operator' => 'NOT IN',
               )
           )"
       [/mla_gallery]
       ```
   
 * Of course, you will have to replace `new-category` and `short` with the appropriate
   term slugs from your application.
 * I have used the alternate “enclosing shortcode” syntax to avoid problems that
   WordPress has with parameters that include => characters.
 * I am marking this topic resolved, but please update it if you have problems or
   further questions regarding the above suggestion. Thanks for your continuing 
   interest in the plugin.
 *  Thread Starter [ratterizzo](https://wordpress.org/support/users/ratterizzo/)
 * (@ratterizzo)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/excluding-categories-13/#post-9483489)
 * OMG!
 * I couldnt develope this on my own from scratch!!! Thanks a lot, it works perfectly!!!
 * Cheers
    Daniel

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

The topic ‘Excluding Categories’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [ratterizzo](https://wordpress.org/support/users/ratterizzo/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/excluding-categories-13/#post-9483489)
 * Status: resolved