sanitize_category( object|array $category, string $context = ‘display’ ): object|array

In this article

Sanitizes category data based on context.

Parameters

$categoryobject|arrayrequired
Category data.
$contextstringoptional
Default 'display'.

Default:'display'

Return

object|array Same type as $category with sanitized data for safe use.

Source

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

Changelog

VersionDescription
2.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.