diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index f59f877775b77..e76b0673c3b0f 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -20,7 +20,7 @@ * Becomes: * * ’cause today’s effort makes it worth tomorrow’s “holiday” … - * + *f * Code within certain HTML blocks are skipped. * * Do not use this function before the {@see 'init'} action hook; everything will break. @@ -5588,18 +5588,13 @@ function wp_strip_all_tags( $text, $remove_breaks = false ) { * @return string Sanitized string. */ function sanitize_text_field( $str ) { - $filtered = _sanitize_text_fields( $str, false ); + if ( ! is_string( $str ) ) { + return ''; + } - /** - * Filters a sanitized text field string. - * - * @since 2.9.0 - * - * @param string $filtered The sanitized string. - * @param string $str The string prior to being sanitized. - */ - return apply_filters( 'sanitize_text_field', $filtered, $str ); -} + $filtered = _sanitize_text_fields( $str, false ); + return apply_filters( 'sanitize_text_field', $filtered, $str ); +} /** * Sanitizes a multiline string from user input or from the database.