Skip to content

Instantly share code, notes, and snippets.

@adnanalbeda
Forked from jaredatch/gist:5645033
Last active February 4, 2023 13:12
Show Gist options
  • Save adnanalbeda/348a0901d82565a7cfecc1e41fba9bc3 to your computer and use it in GitHub Desktop.
Save adnanalbeda/348a0901d82565a7cfecc1e41fba9bc3 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(),
'target' => array(),
'style' => array(),
),
// Quotes
'blockquote' => array(
'cite' => array(),
'style' => array(),
),
// Code
'code' => array(
'style' => array(),
),
'pre' => array(),
// Formatting
'em' => array(
'style' => array(),
),
'strong' => array(
'style' => array(),
),
'del' => array(
'style' => array(),
'datetime' => true,
),
'br' => array(
'style' => array(),
),
'i' => array(
'style' => array(),
),
// Document
'div' => array(
'style' => array(),
),
'span' => array(
'style' => array(),
),
'p' => array(
'style' => array(),
),
'h1' => array(
'style' => array(),
),
'h2' => array(
'style' => array(),
),
'h3' => array(
'style' => array(),
),
'h4' => array(
'style' => array(),
),
'h5' => array(
'style' => array(),
),
// Table
'table' => array(
'style' => array(),
),
'thead' => array(
'style' => array(),
),
'tbody' => array(
'style' => array(),
),
'tfooter' => array(
'style' => array(),
),
'th' => array(
'style' => array(),
'colspan' => array(),
'align' => array(),
),
'td' => array(
'style' => array(),
'rowspan' => array(),
'colspan' => array(),
'align' => array(),
),
'tr' => array(
'style' => array(),
),
// Lists
'ul' => array(
'style' => array(),
),
'ol' => array(
'start' => true,
'style' => array(),
),
'li' => array(
'style' => array(),
),
// Images
'img' => array(
'src' => true,
'border' => true,
'alt' => true,
'style' => 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