kodu aşağıdaki ile değiştirin olacaktır.
<?php
$yazilink="";
$yazilink = get_post_meta(get_the_ID(), "link", true);
if ($yazilink) {
?>
<a class="<?php $category = get_the_category(); echo $category[0]->cat_name;?>" href="<?php echo $yazilink; ?>" target="_blank"></a>
<?php } ?>