wpseek.com
A WordPress-centric search engine for devs and theme authors



sanitize_textarea_field › WordPress Function

Since4.7.0
Deprecatedn/a
sanitize_textarea_field ( $str )
Parameters:
  • (string) $str String to sanitize.
    Required: Yes
See:
Returns:
  • (string) Sanitized string.
Defined at:
Codex:

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.


Source

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