wp_kses_no_null( string $content, array $options = null ): string
Removes any invalid control characters in a text string.
Description
Also removes any instance of the \0
string.
Parameters
-
$content
string Required -
Content to filter null characters from.
-
$options
array Optional -
Set
'slash_zero'
=>'keep'
when''
is allowed. Default is'remove'
.Default:
null
Return
string Filtered content.
Source
File: wp-includes/kses.php
.
View all references
function wp_kses_no_null( $content, $options = null ) {
if ( ! isset( $options['slash_zero'] ) ) {
$options = array( 'slash_zero' => 'remove' );
}
$content = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $content );
if ( 'remove' === $options['slash_zero'] ) {
$content = preg_replace( '/\\\\+0+/', '', $content );
}
return $content;
}
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |