sanitize_textarea_field() - WordPress 函数参考中文文档

返回介绍

sanitize_textarea_field()

发布于 2017-09-11 字数 1548 浏览 997 评论 0

sanitize_textarea_field( string $str )

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.


参数

$str

(string)
(Required)
String to sanitize.


返回值

(string) Sanitized string.


源代码

File: wp-includes/formatting.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 );
}

更新日志

Version 描述
4.7.0 Introduced.

相关函数

Uses

  • wp-includes/formatting.php:
    _sanitize_text_fields()
  • wp-includes/formatting.php:
    sanitize_textarea_field
  • wp-includes/plugin.php:
    apply_filters()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!