Languages: English • 日本語 (Add your language)
Properly strip all HTML tags including script and style.
<?php wp_strip_all_tags( $string, $remove_breaks ); ?>
<?php
$html = '<strong>I am not strong</strong>';
var_dump( $html );
//output '<strong>I am not strong</strong>'
var_dump( wp_strip_all_tags( $html ) );
//output 'I am not strong'
?>
wp_strip_all_tags() is added to the following filters by default (see wp-includes/default-filters.php
):
It is also applied to these filters by default when on the administration side of the site:
Since: 2.9.0
wp_strip_all_tags() is located in wp-includes/formatting.php