Support

Account

Home Forums General Issues When to use ACF select field over taxonomy?

Solved

When to use ACF select field over taxonomy?

  • I just started out with ACF Pro a couple of weeks ago, not learning yet to custom code it but work with some ACF plugins.

    I am building a WooCommerce store (think books & authors) and want to add the country to the author.

    As far as I see it, I have several options
    1. Add country as a custom field / select and just list each country per line in ACF backend

    2. Add a custom taxonomy and connect it to the author. Next, add the taxonomy as an ACF field

    For my use case, the 1st attempt would probably be sufficient.

    However, when would it be better to create a custom taxonomy instead?

  • If each author can only have 1 country then it really does not matter. If you should want to list all authors in a specify country either a taxonomy or a custom field (single select) will perform just as well.

    If on the other hand each author could be listed in multiple countries then you are better off using a taxonomy field (custom taxonomy). Taxonomy queries are easier and perform better than querying for posts based on a multi select field. The reason for this is that a multi select stores values as a serialized array. Looking for one value is not a problem, but looking for posts that might match more than one value becomes complicated and the query performance degrades as you add more values to look for. See section 3 on this page https://www.advancedcustomfields.com/resources/query-posts-custom-fields/

  • Thanks so much, John for this explanation. That was really helpful, as sometimes it’s about understanding the concept & basics before diving deeper into technical implementations 👍

    I also noticed it’s probably not so convenient to show an archive of all authors from a specific country if the country is added as an ACF. So for that it would be also better to use taxonomies.

    For my use case though, I might still go with the ACF field as it’s easier to handle for a starter.

  • Yes, not impossible, but extremely (EXTREMELY) difficult to have archive pages based on ACf field values. If you need archive pages it is always better to use a taxonomy.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.