Ask your WordPress questions! Pay money and get answers fast! (more info)

Links to categories based on a taxonomy WordPress


I need to output a list that contains links to different categories based on a specific taxonomy.

For instance:
When using ”south” in this code, a list of links to all the cities(categories) shows up that are attached to posts and also has the taxonomy term ”south” assigned to it. The link then goes to a category page which shows its posts as usual.

The posts are regular posts and they can have following checked in the admin area; category=cities, custom taxonomy=regions

Any ideas?

I tried this query with no luck: <?php wp_list_categories('taxonomy=region&region=south&orderby=name&show_count=0'); ?>

Answers (5)


Arnav Joy answers:

So you want it like when you pass say south in the function then the code should find out all the posts with south as its term and then find out the categories of those posts and list them?

hlx5 comments:

Yes, I want to:

1.) Pass "south" in the function.
2.) Let the code find all posts that has ”south” checked from a taxonomy called ”regions”
3.) Then let the code find all the categories (cities) these posts has selected.
4.) Then let the code show all the links to these categories (cities)

My dummy page: