<?php
foreach((get_the_category()) as $kategori) {
echo $kategori->cat_name . ' ';
}
?>Bence wp sitesinden bilinen en sağlıklı yöntem bu.
While kasmaz mı biraz?
Bu arada zahit;
<?php $category = get_the_category();
$kat_id = $category[0]->cat_ID; ?>
Bu ilk kategoriyi çeker..Eğer yazı farklı kategorilerdeyse tek bir tanesini gösterir..
Ayrıca id yi döngüye sokmak yerinde direk cat_name desteğini soksak;
<?php
$kategori = get_the_category();
echo $kategori[0]->cat_name;
?>