Support

Account

Home Forums General Issues Getting values from a taxonomy term

Solved

Getting values from a taxonomy term

  • Hi,

    I’m confused about the example referenced in the “Get values from a taxonomy term” article:

    $variable = get_field('field_name', 'product-cat_23');

    I’m not quite sure how the field (‘field_name’) corresponds to the term (‘product-cat_23’) in any meaningful way.

    I understand the supposedly similar method of retrieving values from another post using the same function and that it will return a value of ‘field_name’ for a given post id, but how does this work with taxonomy terms? How and what is this supposed to return? A custom field attached to a term? How is this accomplished?

  • Yes, exactly. You can create field groups that are attached to the terms of a taxonomy the same way that field groups are attached to a post. When editing a term, like a category or tag, the fields can be completed.

    For example, you can add an image field so that you can associate an image with the term. Or you can add a WYSIWYG editor to allow for editable content for a term just like the editor for a post.

    Hope this helps.

    ~JH

  • Excellent. Thanks for the explanation, John.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Getting values from a taxonomy term’ is closed to new replies.