Advanced custom fields – taxonomy terms images [closed]

OK had a go at this myself, I didn’t realise ACF was able to add fields to taxonomies which is really handy so I wanted to figure it out too.

        <?php

        $libargs=array(  
            'hide_empty'        => 0,  
            'parent'        => 0,  
            'taxonomy'      => 'library_categories');  

            $libcats=get_categories($libargs);  

            foreach($libcats as $lc){ 
                $termlink = get_term_link( $lc->slug, 'library_categories' ); 

        ?>

            <a class="single-library-cat" href="https://wordpress.stackexchange.com/questions/71287/<?php echo $termlink; ?>">
                <img src="<?php the_field('taxonomy_image', 'library_categories_'.$lc->term_id); ?>" />
                <?php echo $lc->name; ?>
            </a>

        <?php } ?>

It’s in the docs here http://www.advancedcustomfields.com/docs/tutorials/retrieving-values-from-other-pages-taxonomy-user-media/

<?php the_field('taxonomy_image', 'library_categories_3'); ?>

So just replace the field name with your field name and library_categories_ with the taxonomy name. That should do it!

error code: 523