将类别id传递到get_category_link()
:
<?php
$category = get_the_category();
$link = get_category_link( $category[0]->term_id );
?>
Update 在模板中输出:
<?php
$category = get_the_category();
$first_category = $category[0];
echo sprintf( \'<a href="%s">%s</a>\', get_category_link( $first_category ), $first_category->name );
?>