Several of the description fields in WordPress will strip any HTML entered into them. You can preserve them with a little work, though.
User Descriptions
The biography field on the user profile page accepts a limited number of HTML tags — the same ones allowed in comments. If you need to create richer biographies for your users, you can preserve HTML by adding the following to your functions.php
file:
remove_filter( 'pre_user_description', 'wp_filter_kses' );
Category, Tag, and Taxonomy Descriptions
The taxonomy description fields also prevent you from entering some HTML. To keep it, add this to functions.php
:
remove_filter( 'pre_term_description', 'wp_filter_kses' ); remove_filter( 'term_description', 'wp_kses_data' );
Excerpts
As I’ve mentioned before, there is no easy way to filter the excerpt function to preserve HTML; the PHP strip_tags()
function is part of the_excerpt()
, and there’s no getting around it without recreating the function altogether1. That’s exactly what the Advanced Excerpt plugin does. Download and activate it, and your HTML stays right where you put it.
1 If you’d like to see the_excerpt changed to allow HTML, add a comment on this bug report.
Leave a Reply