Title: Exclude certain category
Last modified: September 28, 2017

---

# Exclude certain category

 *  [leo6912](https://wordpress.org/support/users/leo6912/)
 * (@leo6912)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/exclude-certain-category/)
 * Hi,
 * Is there a way to exclude one or more categorys from being listed?
 * Thanks.

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

 *  Plugin Author [Dani Llewellyn](https://wordpress.org/support/users/diddledani/)
 * (@diddledani)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/exclude-certain-category/#post-9547135)
 * Are you displaying a list of terms from a taxonomy, or are you wanting to filter
   a list of posts by excluding any posts who have the term in question?
 * For the first, displaying a list of terms from a taxonomy, it is currently not
   possible to filter the list in any way (unless I’ve forgotten about it, which
   is entirely possible 🙂 ).
 * If you are displaying a list of posts and wish to exclude posts who have a specific
   term assigned, then this is possible via PHP, but not via the shortcode. For 
   excluding via PHP you would recite the magic words:
 *     ```
       the_a_z_listing( array(
           'post_type' => 'your_post_type',
           'tax_query' => array( array(
               'taxonomy' => 'your-taxonomy', # this is a taxonomy slug
               'field' => 'slug', # this says that we're using slugs in the 'terms' array below
               'terms' => array( 'your-terms' ), # these are term slugs and any number of them are allowed
               'operator' => 'NOT IN',
           ) ),
       ) );
       ```
   
 *  Thread Starter [leo6912](https://wordpress.org/support/users/leo6912/)
 * (@leo6912)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/exclude-certain-category/#post-9562109)
 * Hi,
 * Where can i paste the PHP code? Do i need to make a new custom page template 
   with the code snippet?
 *  Plugin Author [Dani Llewellyn](https://wordpress.org/support/users/diddledani/)
 * (@diddledani)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/exclude-certain-category/#post-9584569)
 * The code needs to be added to an appropriate template in your theme. The [template-hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/)
   page and [image](https://developer.wordpress.org/files/2014/10/wp-hierarchy.png)
   are helpful to determine an appropriate file to add or modify.

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

The topic ‘Exclude certain category’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/a-z-listing_d8edfd.svg)
 * [A-Z Listing](https://wordpress.org/plugins/a-z-listing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/a-z-listing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/a-z-listing/)
 * [Active Topics](https://wordpress.org/support/plugin/a-z-listing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/a-z-listing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/a-z-listing/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Dani Llewellyn](https://wordpress.org/support/users/diddledani/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/exclude-certain-category/#post-9584569)
 * Status: not resolved