Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active February 4, 2023 12:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaredatch/5645033 to your computer and use it in GitHub Desktop.
Save jaredatch/5645033 to your computer and use it in GitHub Desktop.
Modify/change the default allowed tags for bbPress.
<?php
/**
* Modify/change the default allowed tags for bbPress.
*
* The default list (below) is in bbpress/includes/common/formatting.php, L24-66.
* Adjust below as needed. This should go in your theme's functions.php file (or equivilant).
*/
function ja_filter_bbpress_allowed_tags() {
return 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', 'ja_filter_bbpress_allowed_tags' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment