Skip Navigation

[Resolved] Create Country as a taxonomy?

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by himanshuS 3 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#2155071

I am building a job board and have three post types - Company, Job, and Portfolio.

The portfolio CPT is a proxy for users as I can't filter by user attributes.

All thre CPTs need a field to show the country location but with DIFFERENT Meaning.

Company - - where the company is based
Job -- where the job is based
Portfolio - where the user wants to work.

I have only used taxonomies where the meaning of the taxonomy is consistent across all CPTs it is assigned to. That's why I am a bit hesitant to use Location as a taxonomy for these CPTs but technically it should work just fine and I would be able to filter all three CPTs by location.

What would you suggest as the right approach to design this?
Should I create a custom select field or should I use taxonomy?

#2155337

Yes I think technically it should work fine, and taxonomy filters are inherently more performant than custom field filters so it should work well in a custom search for any of these CPTs. One thing you may want to consider in this case is how taxonomy archives will be implemented. In this case, all 3 CPTs could be represented in the same taxonomy archive, so that may or may not be ideal based on your site requirements. Other than that, I don't see any issues with using this type of taxonomy filter.

#2155795

Thanks, Chris.

As a follow-up has Toolset created a ready-made import of the list of countries in the world and even all U.S States?

Doing all that manually will be a pain.

#2156165

Toolset does not maintain such lists, no. I've seen other clients contribute to shared modules that contain country / state / province lists in custom fields, but I'm not sure how much usefulness you will find in these as they may not conform to your needs as a taxonomy:
https://toolset.com/forums/topic/countries-states-cities-taxonomy/
https://toolset.com/forums/topic/how-to-import-states-and-countries-into-selects-for-fields

Other public resources I've seen used for this purpose:
https://wordpress.stackexchange.com/questions/26420/fast-way-to-add-countries-as-a-custom-taxonomy-term

#2159221

My issue is resolved now. Thank you!