WPSEO_Primary_Term::get_terms()protectedYoast 1.0

Get the terms for the current post ID. When $terms is not an array, set $terms to an array.

Метод класса: WPSEO_Primary_Term{}

Хуков нет.

Возвращает

Массив.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_terms();

Код WPSEO_Primary_Term::get_terms() Yoast 22.4

protected function get_terms() {
	$terms = get_the_terms( $this->post_ID, $this->taxonomy_name );

	if ( ! is_array( $terms ) ) {
		$terms = [];
	}

	return $terms;
}