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');
$role->add_cap('unfiltered_html');

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

Like it.? Share it:
Tags:

Comments are closed.