sanitize_category

函数


sanitize_category ( $category, $context = 'display' )
参数
  • (object|array)
    $category
    Category data.
    Required:
  • (string)
    $context
    Optional. Default ‘display’.
    Required:
    Default: ‘display’
返回值
  • (object|array) Same type as $category with sanitized data for safe use.
定义位置
  • wp-includes/category.php
    , line 259
引入
2.3.0
弃用

Sanitizes category data based on context.

function sanitize_category( $category, $context = 'display' ) {
	return sanitize_term( $category, 'category', $context );
}