WordPress at a glance

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.

  • See: sanitize_text_field()
Works based on: _sanitize_text_fields()
✈ 1 time = 0.000098s = very fast | 50000 times = 1.17s = fast PHP 7.1.2, WP 4.7.3
Hooks from function:
Return

String. Sanitized string.

Usage

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

Code of sanitize_textarea_field: wp-includes/formatting.php VER 4.9.8

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

Related Functions

From tag: sanitize_

More from category: Sanitizing, Escaping

No comments
    Hello, !     Log In . Register