Skip to content

Instantly share code, notes, and snippets.

Last active June 4, 2025 21:33
Show Gist options
  • Save ntwb/7797990 to your computer and use it in GitHub Desktop.
Save ntwb/7797990 to your computer and use it in GitHub Desktop.
bbPress - Custom KSES Allowed Tags
<?php
/*
Plugin Name: bbPress - Custom KSES Allowed Tags
Plugin URI: https://gist.github.com/ntwb/7797990
Description: bbPress - Custom KSES Allowed Tags
Version: 0.2
Author: Stephen Edgar - Netweb
Author URI: http://netweb.com.au
*/
add_filter( 'bbp_kses_allowed_tags', 'ntwb_bbpress_custom_kses_allowed_tags' );
function ntwb_bbpress_custom_kses_allowed_tags() {
return array(
// Links
'a' => array(
'class' => true,
'href' => true,
'title' => true,
'rel' => true,
'class' => true,
'target' => true,
),
// Quotes
'blockquote' => array(
'cite' => true,
),
// Div
'div' => array(
'class' => true,
),
// Span
'span' => array(
'class' => true,
),
// Code
'code' => array(),
'pre' => array(
'class' => true,
),
// Formatting
'em' => array(),
'strong' => array(),
'del' => array(
'datetime' => true,
),
// Lists
'ul' => array(),
'ol' => array(
'start' => true,
),
'li' => array(),
// Images
'img' => array(
'class' => true,
'src' => true,
'border' => true,
'alt' => true,
'height' => true,
'width' => true,
),
// Tables
'table' => array(
'align' => true,
'bgcolor' => true,
'border' => true,
),
'tbody' => array(
'align' => true,
'valign' => true,
),
'td' => array(
'align' => true,
'valign' => true,
),
'tfoot' => array(
'align' => true,
'valign' => true,
),
'th' => array(
'align' => true,
'valign' => true,
),
'thead' => array(
'align' => true,
'valign' => true,
),
'tr' => array(
'align' => true,
'valign' => true,
)
);
}
Copy link

angeljs6 commented Jun 4, 2025

This works great, thank you! Is there any way to add font paragraph headings to this code? Also font and font background colours?

Edit: I found some code and figured out the rest :)

// Span 'span' => array( 'class' => true, 'style' => true, ), // Font paragraph headings 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'address' => array(),

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