ACF - Taxonomy field - Display single value

Hi!

I have connected a Taxonomy filed with product tags.

According to ACF documentation, if the field is a radio button or select, it is possible to display a single field without using the looper.

I have tried outputting this field but it is not displayed among custom meta fields.

What is the proper dynamic data to pull a single taxonomy field?

Thank you!

Hello @Misho,

Thanks for writing in! You can then use something like: {{dc:acf:post_field field="field_name"}} in a Headline or Text element.

Hope this helps.

Hi!

Yes, I tried that. But when I output the filed that way, it will show this on the backend:
image

On the front-end, the value is not showing, but breaking the layout.

If I select to output the Term ID instead of the Term Object, it will show the ID number normally, but I need the Object, not the ID.

Thanks!

Hello @Misho,

Please provide us access to your staging URL so that we can check it. When the return value of the field is an object, the dynamic content may require a looper to be able to display which is not the same way as using the code in the documentation. The Term Object is a multidimensional field and this may requires a looper.

Hope this helps.

Hi! Sure.

Here is the test page.

It has a product looper that filters the Outlet category. Each product has a custom field under ACF Pro > Custom fields > Product fields. This particular one is called Brend naocala.

Since the Select field type is chosen, Only one value is possible, and ACF has no trouble displaying it if Term Id is being selected:

image
This is the output:


All term IDs are properly shown.

However, if Term object is chosen, the output is blank.
image

This is clearly either a Pro bug, or there is another way to output the actual value. As mentioned before, this scenario is described in the ACF documentation as perfectly normal.

Please present this to the devs. There are many situations where a single value without a looper is needed with term fields that can output only one value, such as select or the radio button.

Thanks!

Hello @Misho,

Please check out the reply of @Alexander on this thread:

To be able to get the Taxonomy object, we really need to use a nested looper at the moment.

Section
    Row - Looper provider set to dynamic content - Query Builder
        Column - Looper consumer
            Div - Looper provider set to dynamic content - {{dc:acf:post_field field="field_name"}} and set as Looper Consumer
                text - {{dc:term:name}}
                text - {{dc:term:name}}

Kindly check the page now.

Hi,

I see. I do output this taxonomy with the looper in production, but I also have a separate brand field to be able to pass the value to the API.

So essentially this is going to be improved over time. That’s great news!

Thank you!

You are most welcome, Misho.

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