PHP Code

How to display the category description in WordPress

When creating categories in WordPress, you can enter a description. The description field is plain text, but you can enter HTML. However, by default, WordPress doesn't even display the description when you're browsing the category!

This little bit of PHP code will override that. If your template has only one index.php that handles all page request, edit that. Otherwise, if there's an archive.php, edit that instead.

<?php if (is_category()) { ?>
      <h2 class="pagetitle">'<?php echo single_cat_title(); ?>' Category</h2>
      <div id="category-description"> <?php echo category_description(); ?> </div>
<?php  } ?>


  1. Exactly what I needed for my blog, particulary useful for SEO purpose

  2. Works perfectly – just what i needed. Love the web 🙂

  3. good job brother…i've copied your code,then i'll try …thanks you .

  4. Thank you Justin!

  5. This is waht I'm searching for, good work!

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image