WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp kses allowed html

Description

Return a list of allowed tags and attributes for a given context.

This is filtered by the wp_kses_allowed_html hook which provides you with an easy way to change what is allowed html

Usage

<?php $allowed_tags wp_kses_allowed_html$context ); ?>

Parameters

$context
(mixed) (required) The context for which to retrieve tags. Allowed values are post, strip, data, entities or the name of a field filter such as pre_user_description.
Default: None

Return

Returns the list of allowed HTML tags for a given context. The Return value is a multidimensional array with the tag name as the key and an array of attributes as the value.
<?php
$allowed_tags 
wp_kses_allowed_html'post' );
var_dump$allowed_tags );
/*
array(74) {
    ['address'] => array(4) {
        ['class'] => bool(true)
        ['id']    => bool(true)
        ['style'] => bool(true)
        ['title'] => bool(true)
    }
    ...
    ['var'] = >array(4) {
        ['class'] => bool(true)
        ['id']    => bool(true)
        ['style'] => bool(true)
        ['title'] => bool(true)
    }
}
*/

Examples

Notes

Changelog

Source File

wp_kses_allowed_html() is located in wp-includes/kses.php.

Related