Enable or Disable All HTML Tags in WordPress Author Biography Profiles

Enable or Disable All HTML Tags in WordPress Author Biography Profiles

Enable or Disable HTML tags in WordPress Author Bio box

By default, WordPress strips some (but not all) HTML tags. You’re able to type all the HTML you want into the About Yourself –> Biographical Info text box for each WordPress profile, but HTML tags like p (new paragraph) and br (line break) get stripped once you click to save.

Because of this, longer bios look like one big, chunky paragraph instead of being split into several cleaner-looking paragraphs.

Enable all HTML Tags in Profile Bios

To disable the default WordPress HTML tag “sanitization”, you can add this snippet to your theme’s functions.php file or in your own separate plugin:

{code type=php}//disable WordPress sanitization to allow more than just $allowedtags from /wp-includes/kses.php
remove_filter(‘pre_user_description’, ‘wp_filter_kses’);
//add sanitization for WordPress posts
add_filter( ‘pre_user_description’, ‘wp_filter_post_kses’);

After activating this snippet, the author bios can include p, br, and other HTML tags. It can also be useful for adding rel=”author” to each biography box’s Google Plus link as an alternative way to Add Google Plus Authorship to your WordPress Site:

{code type=php}<a href=”https://plus.google.com/yourIDhere” rel=”author”>Your Google Profile</a>


WordPress sanitizes user input for security reasons, not just to annoy you and make you go on a hunt to find this post to learn how to override the annoying setting.

If you’re considering disabling the WordPress sanitization, make sure you trust your users to not enter potentially harmful content into their profile bios. This includes iframes, forms, and more.

Disable all HTML in Profile Bios

If you want the opposite, disallowing all HTML (including the a, blockquote, em, and strong tags, to name a few), you can use the following snippet:

{code type=php}//disallow all HTML tags
add_filter( ‘pre_user_description’, ‘wp_filter_nohtml_kses’);



Here is a list of screenshots for you to compare and contrast. Each image has a descriptive caption and each can be clicked for a larger view.

The WordPress default Profile Biography text box (empty)
Author Biography sample text (with Enable HTML snippet -- HTML tags not stripped)
Theme-specific front-end display of Author bio (with Enable HTML snippet)
WordPress default HTML sanitization after clicking to save text with disallowed HTML tags
No HTML tags allowed (Disable HTML snippet -- after clicking to save)


Credit: html tattoo image