Support

Account

Home Forums General Issues Getting the value from an ACF Taxonomy field

Unread

Getting the value from an ACF Taxonomy field

  • So first I added a new attribute on Woocommerce called “brand”.
    Then, I created an ACF Taxonomy field and set it to be displayed on all of my products.
    It works fine, and my taxonomy can be chosen in the back end without an issue.

    So, how would I get the “brand” value from this field? I’m getting all of the taxonomy objects by using get_fields(‘group_id’), and I can get the taxonomy field label by doing:

    $fields = get_fields('group_12345');
    foreach ($fields as $field) {
    echo '<p>', $field['label'], '</p>';
    // However, I cannot get the value, as it comes out empty. Here I'd like to get "Nike", for example
    echo '<p>', $field['value'], '</p>';
    }

    What I’m trying to achieve is that I can output in my HTML:

    Brand: Nike.

    In my product back end, I have already set up the brand term, and it’s showing up normally. I can even modify it, but I just cannot get to show it in the front end, the ‘value’ is coming out empty.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.