Home Forums Feature Requests Feature Request – Relationship Field Reply To: Feature Request – Relationship Field

  • Why is this not core ACF?

    The following is my opinion and experience from years of digging through ACF code and building code to extend ACF.

    The main issue for not including this in ACF, from my observation, is repeater and flexible content fields (both are repeaters really). Because of the way that ACF manages repeaters it is simply impossible to know match a specific row of a repeater in one post with a specific row of a repeater on another post. Especially considering that rows can be reordered on either side of the relationship.

    My assumption for why it was not included in ACF is that the developer did not want to provide the functionality if it could not be done under all conditions… because as soon as it was added there would be demands that it worked under all conditions.

    Could ACF add limits to not allow bidirectional fields in repeaters. Possibly, but currently ACF does not really allow different settings for field types dependent on if they are top level fields or sub fields. This could potentially be added. But again, I am assuming this has not been done because when it is done, as mentioned above, the developer would get many requests to make it work for sub fields.

    3rd Party plugins can limit how it can be used avoiding the need for the developer to add features that cannot be supported under all conditions. For example the plugin I created that does this only looks at top level fields and avoids the repeater problem by ignoring it completely. This is functionality that I simply refuse to add and consider “Out of Scope”.

    The fact that these bidirectional relationships can be coded only limits what they can do to the abilities of the coder. Might it be possible to do bidirectional fields for repeater sub fields? Maybe… for a specific use case, built and coded for that specific use case.

    What is the difference between Post Object and Relationship fields?

    There are 2 main differences.

    1. The UI presented to users
    2. The number of posts assumed as default.
      • Post Object fields assume a single post but can be made to allow selecting multiple. When allowing multiple selections no limits can be placed on the number of selections.
      • Relationship fields assume multiple selections but can be made to only allow a single selection or require and arbitrary min/max number of selections.

    I have always used these as 1) Post Object fields always allow only one selection. 2) Relationship fields always allow multiple selections.