Support

Account

Home Forums General Issues How to get values from a CUSTOM taxonomy?

Solved

How to get values from a CUSTOM taxonomy?

  • The normal way:
    get_field(‘icon’, ‘category_’ . $term->term_id );
    doesn’t work with CUSTOM taxonomy

  • @moncero,

    Try replacing ‘category_’ with your custom taxonomy slug

  • From documentation:

    All the API functions can be used with a taxonomy term, however, a second parameter is required to target the term ID. This is similar to passing through a post_id to target a specific post object.

    The $post_id needed is a string containing the taxonomy name + the term ID in this format: “$TaxonomyName_$TermID”
    Examples
    Display a field

    <p><?php the_field('field_name', 'thetaxonomyname_7'); ?></p>

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

The topic ‘How to get values from a CUSTOM taxonomy?’ is closed to new replies.