I'm using the Advanced Custom Fields plugin to place a taxonomy checkbox on certain pages.

This checkbox will filter the data that is pulled through etc on that page.

Using the example found on the ACF website (which aims at using the term object output) -


$terms = get_field('taxonomy_field_name');

if( $terms ): ?>


<?php foreach( $terms as $term ): ?>

    <h2><?php echo $term->name; ?></h2>
    <p><?php echo $term->description; ?></p>

<?php endforeach; ?>


<?php endif; ?>

I can't seem to get any data to come through and when i var dump the variable, all i am left with is NULL. This code example above has been placed in the pages normal loop etc. If i change the output to show the ID however, i can see the category ID for each of the selected checkboxes.

Is there any reason why the object term would be coming up as a null array instead of showing me the slug names etc?

Many thanks

2 Answers 2


if I recall correctly, get_field() simply returns the value of the field, not the actual term object. try using this with get_term() (or get_term_by() depending on your needs/preference).

  • Hey, Thanks for the reply. I've done a little more testing since and it seems to work fine on an instant WP twentytweleve theme. I guess i must be doing something different in the theme. Thanks for the advice though. If i struggle to find the link i may use the ID and the get_term function for the time being. Nov 25, 2014 at 18:45

Many ACF fields give you an option of what sort of data you want returned from the field. The default for the taxonomy field is Term ID, while the example code you have is for field set to return Term Object. You can change this setting under the field group in the Custom Fields admin menu page.

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.