Monday , February 3 2025

How to allow HTML tags in WordPress category description

By default, the engine cuts out all HTML tags, and with them the content that we write in the description field for WordPress categories.

To teach WordPress to understand tags, you need to add the following code to the functions.php file:

remove_filter('pre_term_description', 'wp_filter_kses');
remove_filter('pre_term_description', 'wp_kses_data');

By the way, to add a category description to the template, you need to use:

the_archive_description( '<div class="taxonomy-description">', '</div>' ); 

in the place of your theme where you want to display the text from the admin panel.

About iryna

I'm Iryna, a web developer from Ukraine with a decade of experience solving complex technical challenges in the world of freelance. Throughout my career, I've worked on everything from troubleshooting server-side issues and optimizing website performance to enhancing user interfaces. On this blog, I share detailed solutions to the technical problems I’ve encountered and methods that have worked best for me. In addition to my technical expertise, I’m also passionate about digital drawing. I hope the tutorials and insights I provide here will help both fellow developers and creatives alike in their own projects.

Check Also

How to remove 404 //fonts.gstatic.com and //fonts.googleapis.com from WordPress head section

I tried solutions with functions that should remove from head and , but a very …

Leave a Reply

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