Support

Account

Home Forums General Issues Relations between field values

Solved

Relations between field values

  • Hello.
    Working with ACF free version for a while, but now I’m searching for a bigger functionality, but can’t come up how I can do it with ACF.
    I need to make relationship between two different fields and their values.
    For example, there is field with countries as values. And other field – with cities. So, the user should have possibility to make his own cities (repeater in ACF pro) and make relationship with necessary countries (city -> country). Is it possible to do at all?

  • Hi @advelita

    There’s an old tutorial with the similar topic, which you can see here: https://www.bobz.co/dynamically-populate-select-fields-choice-in-advanced-custom-fields/. Unfortunately, I’m not sure if it’s still working or not.

    If you need the relationship, not just assigning a value to another one, then I suggest you create custom post types instead. That way you can use the relationship field or post object field to create the relation between the two object.

    I hope this makes sense 🙂

  • Thanks for the answer @james

    Unfortunately, this doesn’t solve my problem, because countries and cities was just head of the tree, there’s also should be possibility to assign address to city, then date to address etc. Quite a big a tree.

    I reconsider my first question, and, sorry, I did a mistake in it. So, the country should be like post, and then, in that post, custom fields with cities, addresses, dates as values. Then, it should be possibility to make endless quantity of values (repeater, I know), and possibility to assign (or make relationship) address(es) to specific city. Then – date(s) to address. So, city should have many addresses, and after that, address should have many dates.

    Custom post types can’t help here, imo, because it’ll be too complicated for user.

  • Hi @advelita

    Reading your explanation, I think you can achieve it by using the nested repeater. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/working-with-nested-repeaters/.

    But I’m not sure if this is what you want. If it isn’t, could you please explain to me what’s lacking from that method?

    Thanks 🙂

  • Hm. Probably, this can solve my task, but not sure… Don’t have pro version at the moment (sadly, this doesn’t depends on me), so can’t say anything without testing it. Also, can’t find any trial version of ACF pro, so should wait a bit.

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

The topic ‘Relations between field values’ is closed to new replies.