wp_kses_data( string $data ): string

Sanitize content with allowed HTML KSES rules.

Description

This function expects unslashed data.

Parameters

$datastringrequired
Content to filter, expected to not be escaped.

Return

string Filtered content.

Source

function wp_kses_data( $data ) {
	return wp_kses( $data, current_filter() );
}

Changelog

VersionDescription
2.9.0Introduced.

User Contributed Notes

  1. Skip to note 4 content

    To find out what tags are allowed in this function, just access global $allowedtags;. The code here…

    global $allowedtags;
    var_dump($allowedtags);

    …outputs the following:

    array (size=14)
        'a' => array (size=2)
            'href' => boolean true
            'title' => boolean true
    
        'abbr' => array (size=1)
            'title' => boolean true
    
        'acronym' => array (size=1)
            'title' => boolean true
    
        'b' => array (size=0)
    
        'blockquote' => array (size=1)
            'cite' => boolean true
    
        'cite' => array (size=0)
    
        'code' => array (size=0)
    
        'del' => array (size=1)
            'datetime' => boolean true
    
        'em' => array (size=0)
    
        'i' => array (size=0)
    
        'q' => array (size=1)
            'cite' => boolean true
    
        's' => array (size=0)
    
        'strike' => array (size=0)
    
        'strong' => array (size=0)

    And if you wish to modify it to customize the allowed/disallowed tags for everything that uses this function, you can do so using the wp_kses_allowed_html filter and check that the second parameter is equal to 'data'.

You must log in before being able to contribute a note or feedback.