WordPress at a glance

get_term_meta() WP 1.0

Retrieves metadata for a term.

Works based on: get_metadata()
✈ 1 time = 0.000125s = fast | 50000 times = 0.20s = very fast PHP 7.1.2, WP 4.7.3

No Hooks.

Return

Mixed. If $single is false, an array of metadata values. If $single is true, a single metadata value.

Usage

get_term_meta( $term_id, $key, $single );
$term_id(int) (required)
Term ID.
$key(string)
The meta key to retrieve. If no key is provided, fetches all metadata for the term.
Default: ''
$single(true/false)
Whether to return a single value. If false, an array of all values matching the $term_id/$key pair will be returned. Default: false.
Default: false

Code of get_term_meta: wp-includes/taxonomy.php VER 4.9.8

<?php
function get_term_meta( $term_id, $key = '', $single = false ) {
	// Bail if term meta table is not installed.
	if ( get_option( 'db_version' ) < 34370 ) {
		return false;
	}

	return get_metadata( 'term', $term_id, $key, $single );
}

Related Functions

From tag: Metadatas (any)

No comments
    Hello, !     Log In . Register