sanitize_category( object|array $category, string $context = 'display' )
Sanitizes category data based on context.
Parameters
- $category
-
(object|array) (Required) Category data.
- $context
-
(string) (Optional)
Default value: 'display'
Return
(object|array) Same type as $category with sanitized data for safe use.
Source
File: wp-includes/category.php
function sanitize_category( $category, $context = 'display' ) { return sanitize_term( $category, 'category', $context ); }
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/sanitize_category