Home Forums General Issues get_field from Custom Taxonomy


get_field from Custom Taxonomy

  • Hello,

    I have a custom taxonomy for a custom post-type, which both work fine, and I then added custom fields to the taxonomy. For some reason I cannot get the data from the custom field.

    Any help would be appreciated, thanks.

    My custom taxonomy is setup like so:

    		'labels' => array(
    		'name' => 'Video Channel',
    		'add_new_item' => 'tag',
    		'new_item_name' => "tag"
    	'show_ui' => true,
    	'show_tagcloud' => false,
    	'hierarchical' => false

    To retrieve the values, I’m using the following code:

    <?php $events=get_terms('channel','hide_empty=1');?>
    <?php foreach($events as $event):?>
    		<?php $group=get_field('channel_group',$event->slug); echo $group;?>
    <?php endforeach;?>
  • You need to use the taxonomy and the term_id value in your get_field call

    $group=get_field('channel_group', 'channel_'.->$event->term_id);
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘get_field from Custom Taxonomy’ is closed to new replies.