October 18

How to display WordPress Category Without the link

0  comments

By default the wordpress function get_the_category() outputs the category with a link, which is a good thing in most cases. But there comes a time, when you need to output only the category name, without the url. Here’s how you can do it:

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

Good luck.


Tags

tips, wordpress


You may also like

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Get in touch

Name*
Email*
Message
0 of 350