WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WPSEO_Taxonomy_Meta::get_term_meta() public Yoast 1.0

Retrieve a taxonomy term's meta value(s).

{} Это метод класса: WPSEO_Taxonomy_Meta{}

Хуков нет.

Возвращает

Разное|true|false. Value for the $meta if one is given, might be the default. If no meta is given, an array of all the meta data for the term. False if the term does not exist or the $meta provided is invalid.

Использование

$result = WPSEO_Taxonomy_Meta::get_term_meta( $term, $taxonomy, $meta );
$term(разное) (обязательный)
Term to get the meta value for either (string) term name, (int) term id or (object) term.
$taxonomy(строка) (обязательный)
Name of the taxonomy to which the term is attached.
$meta(строка|null)
Meta value to get (without prefix).
По умолчанию: null

Код WPSEO_Taxonomy_Meta::get_term_meta() Yoast 17.3

public static function get_term_meta( $term, $taxonomy, $meta = null ) {
	/* Figure out the term id. */
	if ( is_int( $term ) ) {
		$term = get_term_by( 'id', $term, $taxonomy );
	}
	elseif ( is_string( $term ) ) {
		$term = get_term_by( 'slug', $term, $taxonomy );
	}

	if ( is_object( $term ) && isset( $term->term_id ) ) {
		$term_id = $term->term_id;
	}
	else {
		return false;
	}

	$tax_meta = self::get_term_tax_meta( $term_id, $taxonomy );

	/*
	 * Either return the complete array or a single value from it or false if the value does not exist
	 * (shouldn't happen after merge with defaults, indicates typo in request).
	 */
	if ( ! isset( $meta ) ) {
		return $tax_meta;
	}


	if ( isset( $tax_meta[ 'wpseo_' . $meta ] ) ) {
		return $tax_meta[ 'wpseo_' . $meta ];
	}

	return false;
}