Q:

How to href a category when click. (wordpress)

I have a wordpress portfolio webpage, and I want to display a categories and I want the categories to be clickable, for example: when I click a category, it will redirect me or link me to that specific category and display all the archives that is related to that category.
how do I insert a href so that when I click a category it will link me to a specific category.
here is my source for the category:
<?php
  foreach((get_the_category()) as $category) {
   echo ' <div class="portfolio__labels "> <p>';
   echo $category->name;
   echo ' </p> </div>';
   }
?>

A:

You can try something like this: 
<?php
  foreach((get_the_category()) as $category) {
   echo '<div class="portfolio__labels "> <p>';
   echo '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . $category->name . '</a>';
   //echo $category->name;
   echo '</p> </div>';
   }
?>

