Try this
<a href="https://wordpress.stackexchange.com/category/<?php foreach((get_the_category()) as $category) { echo $category->slug ." '; } ?>">
Hope this helps.
Try this
<a href="https://wordpress.stackexchange.com/category/<?php foreach((get_the_category()) as $category) { echo $category->slug ." '; } ?>">
Hope this helps.