October 13

Allow HTML in category, link, tag descriptions

A client of ours decided they wanted to enter detailed category descriptions on category archive pages. This was easily done but after one or two additions, they wanted to add emphasize and formatting to these descriptions using HTML. Unfortunately, WordPress strips all of that out. To solve that, we dropped this into the theme’s functions.php.

This will only work for users who are admins and will allow admins to add HTML in category descriptions, tag descriptions, link descriptions, link category descriptions and also user descriptions

// Allow HTML in Category Descriptions
<?php
if ( is_admin() ) {
$filters = array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description', 'term_description');
foreach ( $filters as $filter ) {
	remove_filter($filter, 'wp_filter_kses');
}
}?>

Tags


You may also like

Force cPanel Password Reset

Force cPanel Password Reset
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Get in touch

Name*
Email*
Message
0 of 350