Support

Account

Home Forums Front-end Issues Basic display of taxonomy term

Solved

Basic display of taxonomy term

  • Has anyone been able to use the taxonomy term?
    I’ve set an ACF field, where on a page, the user can select which taxonomy to display.
    This taxonomy is from my Custom Post type.
    I’m using checkbox and the return value of the ACF field is set to Term Object.

    The example from the documentation (Basic display (multiple values)), works, but I get an the following error:

    Warning: Illegal offset type in isset or empty in /app/public/wp-includes/taxonomy.php on line 259

    There must be an error in the example code and I can’t figure it out.

    <?php

    $terms = get_field(‘taxonomy_field_name’);

    if( $terms ): ?>

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

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

      <?php endforeach; ?>

    <?php endif; ?>

  • I figured this out, where in the code they have:
    $terms = get_field(‘taxonomy_field_name’);

    I had named my ACF taxonomy term and thus was using taxonomy_term for the field_name.
    That was causing the issue.

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

The topic ‘Basic display of taxonomy term’ is closed to new replies.