A WordPress-centric search engine for devs and theme authors



get_term_meta ›

Since4.4.0
Deprecatedn/a
get_term_meta ( $term_id, $key = '', $single = false )
Parameters: (3)
  • (int) $term_id Term ID.
    Required: Yes
  • (string) $key Optional. The meta key to retrieve. If no key is provided, fetches all metadata for the term.
    Required: No
    Default: (empty)
  • (bool) $single Whether to return a single value. If false, an array of all values matching the `$term_id`/`$key` pair will be returned. Default: false.
    Required: No
    Default: false
Returns:
  • (mixed) If `$single` is false, an array of metadata values. If `$single` is true, a single metadata value.
Defined at:
Codex:

Retrieves metadata for a term.



Source

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 );
}