WPDev.one
Core Function
View Source on Trac ↗

get_term_field()

get_term_field( mixed $field, mixed $term, mixed $taxonomy = '', mixed $context = 'display' )

Gets sanitized term field.

Parameters 3 required

Name / Type Description
$field
string

Term field to fetch.

Required
(int

| WP_Term) $term Term ID or object.

Required
$taxonomy
string

Optional. Taxonomy name. Default empty.

string

$context Optional. How to sanitize term fields. Look at sanitize_term_field() for available options. Default 'display'.

Required

Return Value

((string)
| int | null | WP_Error) Will return an empty string if $term is not an object or if $field is not set in $term.

Function Information

Since Version
2.3.0
Source File
wp-includes/taxonomy.php
Advertisement