Info
- 4 posts
- 3 voices
- Started 2 years ago by Burakhan
- Latest reply from jonich0n
- This topic is not resolved
How can I disable HTML in posts?
-
- Posted 2 years ago #
Hi everyone,
I want to disable HTML codes in posts. I am using "BBcode Lite for bbPress" and I dont need html codes to edit my post. When my member want to add a HTML code that is useful to forums the code works and havent seen properly. How can I disable? -
- Posted 2 years ago #
The allowable HTML tags are in an array called
bb_allowed_tags. I think you could create a plugin that just empties that array.http://bbpress.org/forums/topic/hooks-038-filters-docu#post-6740
I've only seen people requesting the opposite, allowing additional HTML markup, so I'm not sure exactly how to do this.
-
- Posted 2 years ago #
Thanks for your help. I tried but I couldnt do it. Any other ideas?
-
- Posted 7 months ago #
The function you're looking for is bb_allowed_tags in functions.bb-formatting.php, and the allowed tags are stored in an array called $tags.
Create your own plugin file in /my-plugins/, activate it, and apply code to remove (unset) the desired HTML tags from the array. Or just empty the array completely (although I haven't tested this). Below is an example where I removed anchor/hyperlink functionality in posts:
function remove_a_in_allowed_tags( $tags ) {
unset($tags['a']);
return $tags;
}
add_filter( 'bb_allowed_tags', 'remove_a_in_allowed_tags' );
You can quickly test this by inspecting the $tags array with the following code:
// test allowed tags
$tags = bb_allowed_tags();
print_r($tags);
-
This topic is
closed