WordPress at Your Fingertips

get_term_meta() WP 1.0

Retrieves metadata for a term.

1 time — 0.000125 sec (fast) | 50000 times — 0.20 sec (very fast) | PHP 7.1.2, WP 4.7.3

No Hooks.

Return

Mixed. An array of values if $single is false. The value of the meta field if $single is true. False for an invalid $term_id (non-numeric, zero, or negative value). An empty string if a valid but non-existing term ID is passed.

Usage

get_term_meta( $term_id, $key, $single );
$term_id(int) (required)
Term ID.
$key(string)
The meta key to retrieve. By default, returns data for all keys.
Default: ''
$single(true|false)
Whether to return a single value. This parameter has no effect if $key is not specified.
Default: false

Changelog

Since 4.4.0 Introduced.

Code of get_term_meta() WP 5.8.1

function get_term_meta( $term_id, $key = '', $single = false ) {
	return get_metadata( 'term', $term_id, $key, $single );
}

Metadatas (any)

No comments
    Log In