sanitize_textarea_field

The timeline below displays how wordpress function sanitize_textarea_field has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 4.7

/**
 * 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()
 *
 * @since 4.7.0
 *
 * @param string $str String to sanitize.
 * @return string Sanitized string.
 */
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);
}