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.

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.