How to exclude a tag from the get helper

I want to exclude certain tags from the get helper.

I have found someone with the same question and this was the solution:

So I’ve tried the solution, but it isn’t doing anything on my page what I mean with this is that all tags are displayed, including the nft one. I tried adding ‘’ after the = and nft, but that returned no tags at all.

In this case I want to exclude the tag “nft” which is the slug for it.
Any clue why this isn’t working?
Also can someone point out how I can add multiple tags to that filter?

            <div class="tags-listing">
                <ul>
                    {{#get 'tags' limit='all' filter=tag:-hash-nft include='count.posts' order='count.posts desc'}}
                        {{#foreach tags}}
                            <li><a href="/tag/{{name}}">{{name}}</a></li>
                        {{/foreach}}
                    {{/get}}
                </ul>
            </div>

Try this:

{{#get 'tags' limit='all' filter='tag:-nft' include='count.posts' order='count.posts desc'}}

The filter expression should definitely be wrapped in quotes. But if you’re filtering for the tag nft the filter should be tag:-nft. The filter tag:-hash-nft would filter for #nft.

When I do that it shows no tags at all. The ul is empty.
I’m not sure why :s

I have tried a few different filters, but when I use the filter nothing shows up anymore.
I have a feeling the filter isn’t working at all

I just spun up a local test instance to properly look into.

This is the filter that works for me:

{{#get 'tags' limit='all' filter='slug:-nft' include='count.posts' order='count.posts desc'}}

Took me a while of trying different things, but I dug through the documentation and had a lightbulb moment :wink:

Have a look:

  • property - a path representing the field to filter on

Reading this, it made me realise that a tag doesn’t have a field called “tag” – only posts and pages have that.

So, I quickly jumped over to the documentation on the tag context to double-check – and indeed, the field is the slug.

Hope this works now (it does on my end :smiley:)

Thank you this worked!

And this seem to work for multiple slugs
filter='slug:-[art,client,shop]'

Good catch, thanks for debugging it! I’ve updated the original post as well.

Nice! Perhaps you could also add the quotes?

Arggg, thanks… Done!

Awesome! Thanks, this might help other people that find that thread.

Adding to this thread as I’ve found out this slows down my site’s {{get}} helper. Would there be any way to optimize this so my log’s not flooded with warnings?