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 One-time payment   /   Lifetime updates

Ready to Build?

Get the ThemesDNA bundle.

Get all premium ThemesDNA themes with lifetime updates and unlimited website usage for a one-time payment.

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

The complete premium theme bundle

$75

One payment. No renewals.

Get the ThemesDNA Bundle — $75