wp_kses_no_null
Removes any invalid control characters in $string.
Description
Also removes any instance of the \0 string.
Returns (string)
Parameters (2)
- 0. $string (string)
- The string.
- 1. $options — Optional. (null) =>
null
- Set slash_zero => keep. when \0 is allowed. Default is remove.
Usage
if ( !function_exists( 'wp_kses_no_null' ) ) { require_once ABSPATH . WPINC . '/kses.php'; } // The string. $string = ''; // Set 'slash_zero' => 'keep' when '\0' is allowed. Default is 'remove'. $options = null; // NOTICE! Understand what this does before running. $result = wp_kses_no_null($string, $options);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/kses.php
- function wp_kses_no_null( $string, $options = null ) {
- if ( ! isset( $options['slash_zero'] ) ) {
- $options = array( 'slash_zero' => 'remove' );
- }
- $string = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string );
- if ( 'remove' == $options['slash_zero'] ) {
- $string = preg_replace( '/\\\\+0+/', '', $string );
- }
- return $string;
- }