• I’m using the “Advanced Custom Fields – Taxonomy Field add-on” plugin in conjunction with ACF so I can select a category in a repeater field. The problem is that I then need to get the url/link to the category in my template. At the moment all I can seem to do is get the ID of the category. I have this…

    Where the “site_cat_link” is the category ID. This seems to output correctly but then it’s not adding the category url to the ahref.

    I’m sure this is a really simply thing but I’ve been working on this now for too long that I’m just going around in circles!

    <?php
    $category_link = the_sub_field('site_cat_link');
    ?>
    <a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>

    http://wordpress.org/plugins/advanced-custom-fields/

  • The topic ‘get category link from ID’ is closed to new replies.