Home Forums ACF PRO True/False Field in a Custom Taxonomy Loop


True/False Field in a Custom Taxonomy Loop

  • Hey, I’m trying to use ACF to to list a “featured” taxonomy term on a homepage. Basically, I’m looping through a custom taxonomy but only want to show those terms that have a true/false field checked. If this were a normal loop, it’d be easy but looping through the tax terms has complicated things. Any help? I’m having no luck elsewhere.

    Here’s my code so far:

    <?php // latest edition
         $taxonomies = array( 
         $args = array(
         'meta_key' 			=> 'feature_this_edition_on_homepage',
         'meta_value' 		=> '1',
         'orderby'   		=> 'meta_value_num',
                            'order'             => 'DESC',
                            'hide_empty'        => false,
                            'number'            => '1'
                        $terms = get_terms($taxonomies, $args);
                    foreach ( $terms as $term ) {
                    $term_link = get_term_link( $term );
                    if ( is_wp_error( $term_link ) ) {
                    echo '<a href="' . esc_url( $term_link ) . '" class="button">Latest Edition</a>';
                    } ?>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.