HTML in Archive Descriptions

Install WordPress icon
Spread the love

In Where’s my WordPress Tag Description?, I explained the importance of archive descriptions. I also explained how to display them if they do not show in your theme.

Some say that archives are potential duplicate content that need to be left unindexed. I say they can be a great source of useful content that generates automatically. Ever-changing combinations of excerpts reinforce the keyword. If excerpts only display in archives, your content is unique and relevant to visitors. You can make it more relevant and interesting with compelling descriptions.

Unfortunately, there is only a very limited range of HTML markup allowed by default. Normally, when you save a category or tag description, WordPress strips away most of the markup. Often, you want descriptions to list a few key topics in the archive. In fact, it is always good to be as creative as possible in archive descriptions. You are trying to add interest to what is essentially a list of posts.

Allow HTML in Archive Descriptions

Install WordPress iconIt only takes a few lines of code in functions.php to allow HTML markup wherever you need it. As ever, I recommend you install this code in the Funtionality plugin to maintain functions.php with plugins. That’s better than editing your child theme functions.php, which you have to repeat when you change theme.

// 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' );

Do you think it is important to make the most of archive descriptions for categories, tags, and other taxonomies?

Share your thoughts in Shrewdies Make a Website Group, or Shrewdies Website Help Chatroom.