sanitize_term_field

SummerySummery

Cleanse the field value in the term based on the context.

Syntax

sanitize_term_field( string $field, string $value, int $term_id, string $taxonomy, string $context )

DescriptionDescription

Passing a term field value through the function should be assumed to have cleansed the value for whatever context the term field is going to be used.

If no context or an unsupported context is given, then default filters will be applied.

There are enough filters for each context to support a custom filtering without creating your own filter function. Simply create a function that hooks into the filter you need.

ParametersParameters

$field

(string) (Required) Term field to sanitize.

$value

(string) (Required) Search for this term value.

$term_id

(int) (Required) Term ID.

$taxonomy

(string) (Required) Taxonomy Name.

$context

(string) (Required) Context in which to sanitize the term field. Accepts 'edit', 'db', 'display', 'attribute', or 'js'.

ReturnReturn

(mixed) Sanitized field.

SourceSource

File: wp-includes/taxonomy.php


			

ChangelogChangelog

Changelog
Version Description
2.3.0 Introduced.
Scroll to Top