ACF Relationship field type stops layout builder preview from loading

I have two custom post types Attorney and Location.

In the Attorney CPT I have an ACF Relationship field (office_location) that lets me select the location(s) for the attorney (ie the City for the branch they are in).

In the Layout Builder I set to use on CPTs for attorneys I have a text element with the dynamic content to pull in an ACF term {{dc:acf:field field=“office_location”}}

If I choose a different attorney to preview I get the “preview could not load”, on the front end nothing on the page is rendered after the location of the dynamic text field location. If I go back into the builder and select the text element and delete it everything is rendered again.

Hi @designerken,

Thanks for reaching out about this. In its current form, our ACF integration doesn’t allow retrieving relational fields. It’s limited to where it can only retrieve values that are returned in the form of a string. That being said, for our next update we’ve retooled our ACF integration to allow:

  • Retrieving fields from Posts, Terms, and Option Pages
  • Loop over Repeater fields
  • Access data in relational fields (single or multiple)
  • When a relationship is a Post or Term, you’ll be able to all of the normal data of those entities along with any of their ACF fields.
  • Properly preview the ACF field data from the Dynamic Content modal.

The repeater relational fields will be accessible through a new Looper Provider type called “Dynamic Content” that will let you choose from ACF fields that return an object or array.

This update is scheduled to be released early in March. I’ve also checked to make sure the behavior you’re seeing is corrected. If you try to retrieve a non string field in a text element it will just output an empty string (the preview doesn’t break).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.