I first stumbled upon this issue on my own sites and recently had a user of Advanced Ads stuggling with the same: You want to give your category or tag archive pages a nice description, use images and even add some shortcodes? This all is possible with the rich media editor called TinyMCE that looks exactly like the editor for posts.

But wait, there is actually no such editor when editing taxonomy descriptions as a core feature in WordPress. Though, you might still see it.

The reason is that you are probably using the Yoast SEO plugin. Having a rich media editor to edit pages for categories, tags or other custom taxonomies is one of their features.

category description editor
The rich media editor for the description actually added by Yoast SEO.

Shortcodes not working in the editor

While this looks like a full fletched content editor, it is actually not. The feature to interpret shortcodes is missing from here. So when adding a shortcode like in order to display an ad into the editor, it will just be stripped away in the frontend and not show anything.

How to fix the shortcode?

I contacted Yoast about that problem in this github issue. By the time I am writing this, they have not yet decided whether to include the fix into the main plugin. Though, you can add it yourself rather easily.

In order to allow shortcodes in all category, tag and custom taxonomy descriptions, just put the following code into the functions.php of your theme.

add_filter( 'term_description', 'do_shortcode' );Code language: JavaScript (javascript)

If you want to allow shortcodes only for specific taxonomies or custom taxonomies, follow these steps:

First, you would need to identify the internal slug of your custom taxonomy. For categories this is category, for tags post_tag. Custom taxonomies have their own ids.

Now, add _description to it.

Finally, you would need to add the following line to the function.php file of your theme.

For categories:

add_filter( 'category_description', 'do_shortcode' );Code language: JavaScript (javascript)

For tags:

add_filter( 'post_tag_description', 'do_shortcode' );Code language: JavaScript (javascript)

And an adjusted version of this for custom taxonomies.

The Author


    1. Thomas Maier Article Author

      Sorry, but if the solution here does not help, I have no other prepared.

  1. Pingback: Shortcodes not working in category or tag description - Le Developpeur