Skip to content

Instantly share code, notes, and snippets.

@stephenharris
Last active February 3, 2020 08:44
Show Gist options
  • Save stephenharris/6078242 to your computer and use it in GitHub Desktop.
Save stephenharris/6078242 to your computer and use it in GitHub Desktop.
By default bbpress can be quite strict on the HTML it allows in posts (tags are whitelisted). The following loosens those restrictions and is taken from this post: http://buddypress.org/support/topic/tutorial-allow-more-html-tags-in-bp-forum-topics/
<?php
function myprefix_kses_allowed_tags($input){
return array_merge( $input, array(
// paragraphs
'p' => array(
'style' => array()
),
'span' => array(
'style' => array()
),
// Links
'a' => array(
'href' => array(),
'title' => array(),
'rel' => array()
),
// Quotes
'blockquote' => array(
'cite' => array()
),
// Code
'code' => array(),
'pre' => array(),
// Formatting
'em' => array(),
'strong' => array(),
'del' => array( 'datetime' => true, ),
// Lists
'ul' => array(),
'ol' => array( 'start' => true, ),
'li' => array(),
// Images
'img' => array(
'src' => true,
'border' => true,
'alt' => true,
'height' => true,
'width' => true,
)
));
}
add_filter( 'bbp_kses_allowed_tags', 'myprefix_kses_allowed_tags', 999, 1 );
?>
@ajtruckle
Copy link

How can I add support for videos?

See:

https://bbpress.org/forums/topic/extra-tags-to-add-to-list-for-videos/#post-205701

I added:

'video'      => array(
	'controls' => true,
	'width'    => true,
	'height'   => true,
),
'source'     => array(
	'src'    => true
)

But it is not right. The source inner component gets stripped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment