How to exclude category from get_the_category?

Discussion in 'WordPress' started by Divvy, Dec 15, 2016.

  1. #1
    Hello,

    Can someone please give me a little help here?
    I need to exclude a category (ID76) from listing, but I'm too newbie to do this. I already searched for a solution but couldnt do it myself.

    Here's my code:

    <?php $categories = get_the_category();
     if($categories){
    ?>
     <div id="includes">CATEGORIES</div>
     <?php
    foreach ( $categories as $category ) { 
    echo '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ><div class="tags">'.$category->name.'</div></a>'; 
    }
    ?>
    PHP:
    Thank you guys! :)
     
    Divvy, Dec 15, 2016 IP