ACF returning category ID for taxonomies, not value

[This is a followup to this post, now that I have a dev site you can check out]

Hi. I’m working on a single page layout that leverages an ACF field group that has both single-element components (number, text) but also 3 taxonomies within a custom post type.

When I try to call the values logged in a specific page, I can get the_content and the two single element fields to show up no problem. But when I try the same for the taxonomies (Grape, Vineyard, Vintage), I either get nothing via an ACF query (for example {{dc:acf:post_field field="vineyard"}} , or I get the category ID number using {{dc:post:meta key="vineyard"}} .

(I’ve set each of those taxonomic fields to Return Term Object, btw)

I’m guessing a clue is that when I use the Dynamic Content generator I see those single-fields, but not the fields that are taxonomies:

Screenshot 2024-08-01 at 7.13.14 PM

I know ACF is a third party product, but I have a feeling I’m just not constructing the query correctly, and hoping you can give me some guidance. Thanks in advance!

Yikes! I also just discovered that uploading the site and database from local to dev, the ACF Field links are no longer showing up in the Layout. The code and structure is exactly the same, and I’ve saved each again. Ideas?
Here’s the way it looks on local:

Hey Matt,

Thanks for reaching out!

The setup works perfectly, the only reason it is not showing the value is that the return type of the ACF field is an object. With that said, in your looper consumer text, instead of using {{dc:acf:post_field field="vineyard"}}, you should use {{dc:looper:field key="name"}} to get the name and {{dc:looper:field key="term_id"}} to get the ID.

Also, if you want to get the lists of the fields, you can use {{dc:looper:item type="json"}}.

Hope that helps.

Hey Matt,

Since the {{dc:acf:post_field field="vineyard"}} dynamic content could return several Vineyards, you will need to use Looper Provider Dynamic Content to display them all. Just like this:

I made a demo layout to see how you will display fields that return objects.

  • See the secure note below.

Best Regards.

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