Allow HTML Tags in Author Biographical Info in WordPress

By ThemesDNA1 min read

Share:

The "Biographical Info" field for authors in WordPress does not support all HTML tags. By default, the "strong" and "a href" tags are available for use. Some authors may find it helpful to break up lengthy biographies into sections using HTML's paragraph (p), line break (br) and other tags. The following code must be added to the functions.php file of your theme in order to enable this feature.

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

Note:
For security reasons, WordPress sanitizes user input. If you're thinking about turning off WordPress sanitization, make sure you trust your users not to put potentially harmful content in their profile bios. This includes iframes, forms, and other elements.

Premium WordPress themes Made for WordPress   /   Ready for your story

Ready to Build?

Your next great website starts here.

Build more websites with one flexible collection—and keep every theme for life.

  • 56+ themes
  • Lifetime updates
  • Unlimited websites
  • No renewals

The complete collection

$75

One payment. No renewals.

Get the Themes Bundle — $75