bbp_kses_allowed_tags()

Custom allowed tags for forum topics and replies

Description

Allows all users to post paragraphs, links, quotes, code, formatting, lists, and images

Return

(array) Associative array of allowed tags and attributes

Source

File: bp-forums/common/formatting.php

function bbp_kses_allowed_tags() {
	return apply_filters( 'bbp_kses_allowed_tags', array(

		//Paragraph
		'p' => array(),

		// Links
		'a' => array(
			'href'     => array(),
			'title'    => array(),
			'rel'      => array(),
			'target'   => 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,
		)
	) );
}

Changelog

Changelog
Version Description
bbPress (r4603) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.