Allow HTML in WordPress Category & Taxonomy Descriptions


There’s a WordPress field we think is vastly underused. It’s the description field attached to each category and custom taxonomy. Not sure what I mean?

Log in to your site and go edit a post category. There you’ll see a description field which most people think is just for internal use. Well, it’s not!

Enter some text, save the category, and now view that category page on your website. You should see the description below the category name. If not, your theme wasn’t coded to include this.

Wiring up your theme to support category descriptions

You can skip this step if your theme already does this. If not, read on. You’ll first need to edit your category.php. Now pick a spot where you’d like the category description to appear. We usually put it below the category title tag like such:

<h1 class="title"><?php printf( __( 'Category Archives: %s', 'appthemes' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>
// this part is new
$cat_desc = category_description();
if ( ! empty( $cat_desc ) ) {
    echo apply_filters( 'category_archive_meta', '<div class="cat-desc">' . $cat_desc . '</div>' );

Want the same thing for a custom taxonomy? Replace the category_description() function call with term_description(). For bonus points, you can also do this for your tag page templates. Just use the tag_description() function.

If you aren’t already using the category, taxonomy, and tag description fields, we highly recommend starting now. Not only is this a great way to write descriptive unique text for each of those items, it also adds SEO value by creating unique content and beefing up your pages.

The only limitation is no HTML is allowed in the category or taxonomy descriptions. WordPress strips it out by default. Which now brings us to the reason you’re actually reading this article!

Enabling HTML in your category & taxonomy descriptions

Open up your theme’s functions.php file and add the following code:

// allow html in category and taxonomy descriptions
remove_filter( 'pre_term_description', 'wp_filter_kses' );
remove_filter( 'pre_link_description', 'wp_filter_kses' );
remove_filter( 'pre_link_notes', 'wp_filter_kses' );
remove_filter( 'term_description', 'wp_kses_data' );

Now go back into wp-admin and edit your category. This time, add some html and then save it. Here’s an example:

Visit your category page and you should now see the marked up description!


Adding this code removes the native security filters WordPress applies to those fields. If you are running a small site with only a few trusted authors, then you won’t have any problems. On the other hand, if you’re running a large-scale Multisite instance with unknown users, it’s safer not to follow this tutorial.

Besides just HTML, users could add malicious code (on purpose or by accident) which could hurt your site. Exercise with caution, otherwise enjoy your HTML-enabled descriptions!

Like this tutorial? Subscribe and get the latest tutorials delivered straight to your inbox or feed reader.

Your rating: none
Rating: 4.8 - 6 votes

Written by: on July 26, 2012. Last modified: July 27, 2012

Popular Marketplace Items

  • balanced-payments-plugin-sm

    Balanced Payments

    Accept credit cards and setup escrow payments.
  • wp-smart-export-final

    WP Smart Export

    A highly customizable WordPress data exporter plugin.
  • at_autosuggest_taskerr_thumb

    AutoSuggest – Taskerr

    Automatically suggests services as the user types.
  • featured

    QR Codes Widget

    Add a widget with QR codes to your AppThemes site.
  • classipress-fortumosms-gateway

    Fortumo SMS payment gateway

    Fortumo sms payment gateway for ClassiPress
  • Authorize.Net Thumbnail


    Easily start accepting online payments via credit card and e-check.
  • AppThemes Coupon Plugin

    AppThemes Coupons

    An easy way to start offering coupons and promotions to your customers.
  • woo_goodstore_thumb


    A clean, modernĀ and fully responsive WooCommerce Fashion Theme.
  • woo_marine_thumb


    A clean, modernĀ and fully responsive marine-based goods WooCommerce Theme.
  • daddy-likes-190x130

    Daddy Like

    A fast, lightweight, and elegant "like" system for comments, pages, posts, & activities.
  • Custom Greeting

    Custom Greeting

    Easily replace the default WordPress greeting.
  • classpress tabber


    Show specific custom fields as tabs on an ad detail page.
  • GeoReg thumbnail


    Captures detailed geographic info with new user registrations.
  • adposter-blocker-thumbnail

    AdPoster Blocker

    A simple but powerful plugin that blocks spammy new user regs and/or ads/jobs/posts.
  • critic-icon-2


    A professional review and rating system for WordPress.
  • autoauto-thumbnail

    AutoResponder AutoRegistration

    Automatically integrates WordPress registration with major autoresponders.
  • thumnail

    Category Icons

    Add icons to your ClassiPress categories
  • StarStruck WordPress Plugin Thumbnail


    A fast, lightweight, and elegant star rating system for comments, pages, & posts.
  • pcp-featured

    Price Comparer

    Jump start your Price Comparision site with products from Amazon, Commission Junction, and LinkShare.
  • stripe-plugin


    Process credit cards safely and securely on your AppThemes website.
  • 2Checkout Payment Gateway Plugin


    Accept up to eight payment methods, fifteen languages, & twenty six currencies.
  • screenshot


    A conversion focused responsive Clipper child theme with premium features.