By default, bbPress limits which HTML tags are allowed in the topics and replies content and even which HTML tag attributes are allowed. Only keymasters and moderators can post using expanded set of HTML tags and attributes.
By default, bbPress allows only some tags to be included, and for them only some of the attributes. So, you can’t use ‘class’ attribute for any of the tags, and you can’t use ‘style’ attribute too.
Custom Code
This example will add class and style attributes to some of the tags, and one new tag. You can expand it further with more tags and more attributes.
add_filter('bbp_kses_allowed_tags', 'bbhelp_club_kses_allowed_tags', 10000); function bbhelp_club_kses_allowed_tags($list) { // modify IMG tag // $list['img']['class'] = true; $list['img']['style'] = true; // modify UL/OL tags // $list['ul']['class'] = true; $list['ul']['style'] = true; $list['ol']['class'] = true; $list['ol']['style'] = true; // add SPAN tag $list['span'] = array( 'class' => true, 'style' => true ); return $list; }
Using a plugin
If you don’t want to add custom code, you might wanna consider one of the plugins that can do this:
- GD bbPress Toolbox Pro – this plugin has option to enable expanded list of HTML tags and attributes, or even enable full set of tags and attributes.