Ecommerce Shopify WordPress Discussion

How to filter tags by category in WordPress?

I am trying to filter the tags depending on which category you are on. For example if I clicked on 'Bespoke Legacy Support' which has three posts: Post One - Tag: Artificial Intelligence Post Two - Tag: CRM Post Three - Tag: Artificial Intelligence Then the sidebar filters will only show 'Artificial Intelligence and CRM', but at the moment it shows all tags that aren't empty under 'Filter by Product', please see a screenshot below of how this looks: The code I have got at the moment is: $tags = get_tags(array( 'cat' => '62', 'hide_empty' => true )); foreach ($tags as $tag) { $class = ( $tag_id == $tag->term_id ) ? 'active' : ''; echo '<p><a class="' .$class. '" href="/category/case-studies/bespoke-legacy-support?tags=' . $tag->term_id . '&tagname=' .$tag->name. '&catname=' .$cat_id. '">' . $tag->name . ''; if($catfiltern == '62') { echo ' (' .$tag->count. ')</a></p>'; } else { echo '</a></p>'; } } I appreciate any help with this and anything else you need to know I can share. I've tried changing the 'cat' ID but when I change this ID the page breaks and doesn't show anything.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.