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