sanitize_category( object|array $category, string $context = 'display' )

Sanitizes category data based on context.


Parameters Parameters

$category

(object|array) (Required) Category data.

$context

(string) (Optional)

Default value: 'display'


Top ↑

Return Return

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


Top ↑

Source Source

File: wp-includes/category.php

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


Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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