Get List of Terms based on a given term (different taxonomy)

I have two taxonomy and a post type.

  1. Post type: Employee (employee)

  2. Taxonomy: Location (term example chicago, id 1)

  3. Taxonomy: Job Title (job-title)

I want to list all job title based on a particular location. If CPT not available on that location the job title shouldn't be added.

I have tried to use WP_Term_Query() and wp_terms() but haven't found a way.

Topic terms taxonomy custom-post-types Wordpress

Category Web


You will need a two step process for that.

  1. Get all the posts from the location (Using WP_Query(). You will only need the ID of the posts, so get_posts() will do too.),
  2. Now use wp_get_post_terms() to retrieve the job titles from the posts.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.