WordPress: Paragraphs dissapeared upon form submission

If you try submitting a comment, post or a page and find your line breaks, paragraphs or other tags got stripped, don’t worry.

WordPress is trying to be intelligent. It processes all data submitted by default. This filtering process is managed by kses (see wp-includes/kses.php). Most roles, other than administrator, doesn’t have full control over the html tags submitted (see http://codex.wordpress.org/Roles_and_Capabilities). The library that manages this function is (wp-includes/capabilities.php). To add certain capabilities to certain role, you have to do it manually. There are of course nice plugins to handle this but if you just want to do it for a one role (‘customer’ in this case) for example, its just 2 lines of code.

$role = get_role('customer');

“customer” can now use any html tags in the submission form.

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.