Sanitizes category data based on context.
$categoryobject|arrayrequired
$contextstringoptional
'display'.Default:'display'
function sanitize_category( $category, $context = 'display' ) {
return sanitize_term( $category, 'category', $context );
}
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/sanitize_category