Display wordpress category name without link

January 23, 2009 · Print This Article

When you’re using the the_category( ) function to display the category name of a post, a link to the category archive is automatically created by WordPress.

While this is a good thing in most cases, what if you don’t want to create a link? Here’s an easy way to do it.

To display the category name without haveing a link to the category archive being automatically created, simply open replace the_category( ) by the following code:

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


Your choice for site templates and wordpress themes

Comments

One Response to “Display wordpress category name without link”

  1. Webanhalter on January 20th, 2010 2:20 am

    Is there any way to do the same with tags?

Got something to say?

You must be logged in to post a comment.