Last active
February 3, 2020 08:44
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); | |
?> |
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
Mmm.... For no.2 have you checked the actual HTML - it could be bullet points without the styling (At least, I recall having to tweak bbPress' css). On a test site everything rendered correctly (for admin / author ).
(Editing from the admin doesn't produce these errors, so maybe bbPress is doing something somewhere to the post content when editing it from the frontend.)
I'll try and take a proper look at this over the weekend. I do take on freelance work, but this is a plug-in I actively use and (try to) maintain. So if you want to buy me a beer, you can, but there's obligation :).