Exclude term from Loop

Is there a way to exclude a taxonomy term from a Loop? For example, I have a tag named ‘hidden’. When displaying the loop I want to show everything except the posts with that tag.

Could you use the exclude attribute for this? See the second item in the taxonomy term loop docs.

I just realized that you didn’t specify what type of loop you’re using. If you’re using a post loop, you could use exclude_tag or exclude_category.

Yes, a post loop. Will this work with a custom taxonomy? It’s for learndash (ld_course_tag)

Sorry, didn’t think to include that information :see_no_evil:

1 Like

Ah, good point about custom taxonomies. For that, you’d probably want to use the taxonomy, taxonomy_compare, and terms attributes. There are a couple of examples in the docs, but in your case it’d be something like this (I forget what LD calls their post type):

<Loop type=course taxonomy=ld_course_tag taxonomy_compare=not terms=hidden>
1 Like

Perfect! Thank you so much for you help!!

1 Like