Uses
Uses | Description |
---|---|
wp-includes/kses.php: wp_kses_no_null() | Removes any invalid control characters in a text string. |
wp-includes/kses.php: wp_kses_bad_protocol_once() | Sanitizes content from bad protocols and other characters. |
Sanitizes a string and removed disallowed URL protocols.
This function removes all non-allowed protocols from the beginning of the string. It ignores whitespace and the case of the letters, and it does understand HTML entities. It does its work recursively, so it won’t be fooled by a string like javascript:javascript:alert(57)
.
(string) (Required) Content to filter bad protocols from.
(string[]) (Required) Array of allowed URL protocols.
(string) Filtered content.
File: wp-includes/kses.php
function wp_kses_bad_protocol( $string, $allowed_protocols ) { $string = wp_kses_no_null( $string ); $iterations = 0; do { $original_string = $string; $string = wp_kses_bad_protocol_once( $string, $allowed_protocols ); } while ( $original_string != $string && ++$iterations < 6 ); if ( $original_string != $string ) { return ''; } return $string; }
Version | Description |
---|---|
1.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_kses_bad_protocol