Languages: English • 日本語 (Add your language)
This function makes sure that only the allowed HTML element names, attribute names and attribute values plus only sane HTML entities will occur in $string. You have to remove any slashes from PHP's magic quotes before you call this function.
<?php wp_kses($string, $allowed_html, $allowed_protocols); ?>
This is an example of how to format an array of allowed HTML tags and attributes.
array( 'a' => array( 'href' => array(), 'title' => array() ), 'br' => array(), 'em' => array(), 'strong' => array(), );
wp_kses() is located in wp-includes/kses.php
.
See: Data Validation article for an in-depth discussion of input and output sanitization.