WordPress at Your Fingertips

sanitize_textarea_field() WP 1.0

Sanitizes a multiline string from user input or from the database.

The function is like sanitize_text_field(), but preserves new lines (\n) and other whitespace, which are legitimate input in textarea elements.

1 time — 0.000098 sec (very fast) | 50000 times — 1.17 sec (fast) | PHP 7.1.2, WP 4.7.3
Hooks from the function

Return

String. Sanitized string.

Usage

sanitize_textarea_field( $str );
$str(string) (required)
String to sanitize.

Notes

Changelog

Since 4.7.0 Introduced.

Code of sanitize_textarea_field() WP 5.8.1

function sanitize_textarea_field( $str ) {
	$filtered = _sanitize_text_fields( $str, true );

	/**
	 * Filters a sanitized textarea field string.
	 *
	 * @since 4.7.0
	 *
	 * @param string $filtered The sanitized string.
	 * @param string $str      The string prior to being sanitized.
	 */
	return apply_filters( 'sanitize_textarea_field', $filtered, $str );
}

sanitize_

Sanitizing, Escaping

No comments
    Log In