Support

Account

Home Forums Bug Reports get_field_objects() returning false for Taxonomy query Reply To: get_field_objects() returning false for Taxonomy query

  • Hi @oppodeldoc

    The get_field_objects() function would not work in this scenario since you are trying to query some term objects.

    I would recommend you make use of a for each loop to get the terms as shown below:

    <?php 
    
    $terms = get_field('taxonomy_field_name');
    
    if( $terms ): ?>
    
    	<ul>
    
    	<?php foreach( $terms as $term ): ?>
    
    		<h2><?php echo $term->name; ?></h2>
    		<p><?php echo $term->description; ?></p>
    		<a href="<?php echo get_term_link( $term ); ?>">View all '<?php echo $term->name; ?>' posts</a>
    
    	<?php endforeach; ?>
    
    	</ul>
    
    <?php endif; ?>