How To Display Category Name Without Link?

Posted by

Hi,

The_category() function is used to display categories in the post of the blog. A link to the category archive is automatically created by wordpress which is always good for the blog. But many users does not want to give links to the post categories.

In order to display category name without a link to the category archive, you need to edit the page/php and open replace the_category( ) with this code:

<?php
$category = get_the_category();
echo $category[0]->cat_name;
?>

That’s it!

Thanks,

Shane G.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.