wpseek.com
WordPress开发者和主题制作者的搜索引擎



sanitize_text_field › WordPress Function

Since2.9.0
已弃用n/a
sanitize_text_field ( $str )
参数:
  • (string) $str String to sanitize.
    Required: Yes
查看:
返回:
  • (string) Sanitized string.
定义在:
文档:

Sanitizes a string from user input or from the database.

- Checks for invalid UTF-8, - Converts single </code> characters to entities - Strips all tags - Removes line breaks, tabs, and extra whitespace - Strips percent-encoded characters


源码

function sanitize_text_field( $str ) {
	$filtered = _sanitize_text_fields( $str, false );

	/**
	 * 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 );
}