Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



sanitize_text_field ›

Od2.9.0
Przestarzałyn/a
sanitize_text_field ( $str )
Parametry:
  • (string) $str String to sanitize.
    Wymagane: Tak
Zobacz:
Powrót:
  • (string) Sanitized string.
Zdefiniowane na:
Codex:

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 octets


Źródło

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