Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
sanitize_term_field() - 根据上下文对分类项(term)中的字段值进行清理 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / sanitize_term_field()

sanitize_term_field( string $field, string $value, int $term_id, string $taxonomy, string $context ): mixed

根据上下文对分类项(term)中的字段值进行清理


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "2f423505ec1443067c06409ec132c281" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "e283cc7ab1dbef6488b2693a393334ea" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "80fa2dd3f78b55ea2349d22e0a81c475" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "90276a70c1ce682ec49779101f60796b" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

field 字段more...

kses 清理

sanitize 清理more...

term 分类项more...


描述

通过函数传递一个分类项字段的值,应该被假定为已经为分类项字段将要使用的上下文清理了该值。

如果没有给定上下文或不支持的上下文,则将应用默认过滤器。

每个上下文都有足够的过滤器来支持自定义筛选,而无需创建自己的过滤函数。只需创建一个与所需过滤器挂钩的函数。


参数

$fieldstring必填
要清理的分类项(term)字段。
$valuestring必填
搜索此分类项值。
$term_idint必填
分类项 ID。
$taxonomystring必填
分类法(taxonomy)名称。
$contextstring必填
清理分类项字段的上下文。
接受'raw'、'edit'、'db'、'display'、'rss'、'attribute'或'js'。默认'display'。

返回

mixed 清理后的字段。


钩子

apply_filters( "edit_term_{$field}", mixed $value, int $term_id, string $taxonomy )

过滤要编辑的分类项(term)字段,然后再对其进行清理。

apply_filters( "edit_{$taxonomy}_{$field}", mixed $value, int $term_id )

在清理分类法字段之前,过滤要编辑的分类字段。

apply_filters( 'pre_category_nicename', string $value )

在清理类别nicename之前对其进行过滤。

apply_filters( "pre_term_{$field}", mixed $value, string $taxonomy )

在清除分类项(term)字段值之前过滤该值。

apply_filters( "pre_{$taxonomy}_{$field}", mixed $value )

在清理分类法字段之前过滤该字段。

apply_filters( "term_{$field}", mixed $value, int $term_id, string $taxonomy, string $context )

过滤清理以供显示的分类项(term)字段。

apply_filters( "term_{$field}_rss", mixed $value, string $taxonomy )

过滤在RSS中使用的分类项(term)字段。

apply_filters( "{$taxonomy}_{$field}", mixed $value, int $term_id, string $context )

过滤清理以供显示的分类法字段。

apply_filters( "{$taxonomy}_{$field}_rss", mixed $value )

过滤在RSS中使用的分类法字段。



源码

查看源码 官方文档


更新日志

版本描述
2.3.0开始引入

Warning: Undefined variable $o in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference.php on line 194