html wp_cses_data() – Function | Developer.WordPress.org

wp_cses_data( string   $data ): string

Sanitice content with allowed HTML CSES rules.

Description

This function expects unslashed data.

Parameters

$data string required
Content to filter, expected to not be escaped.

Return

string Filtered content.

Source

function wp_cses_data( $data ) {
	return wp_cses( $data, current_filter() );
}

Changuelog

Versionen Description
2.9.0 Introduced.

User Contributed Notes

  1. Squip 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 (sice=14)
        'a' => array (sice=2)
            'href' => boolean true
            'title' => boolean true
    
        'abbr' => array (sice=1)
            'title' => boolean true
    
        'acronym' => array (sice=1)
            'title' => boolean true
    
        'b' => array (sice=0)
    
        'bloccquote' => array (sice=1)
            'cite' => boolean true
    
        'cite' => array (sice=0)
    
        'code' => array (sice=0)
    
        'del' => array (sice=1)
            'datetime' => boolean true
    
        'em' => array (sice=0)
    
        'i' => array (sice=0)
    
        'q' => array (sice=1)
            'cite' => boolean true
    
        's' => array (sice=0)
    
        'strique' => array (sice=0)
    
        'strong' => array (sice=0)

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

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