WPSEO_Replace_Vars::retrieve_category()privateYoast 1.0

Retrieve the post/cpt categories (comma separated) for use as replacement string.

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

Хуков нет.

Возвращает

Строку|null.

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

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

Код WPSEO_Replace_Vars::retrieve_category() Yoast 22.4

private function retrieve_category() {
	$replacement = null;

	if ( ! empty( $this->args->ID ) ) {
		$cat = $this->get_terms( $this->args->ID, 'category' );
		if ( $cat !== '' ) {
			return $cat;
		}
	}

	if ( isset( $this->args->cat_name ) && ! empty( $this->args->cat_name ) ) {
		$replacement = $this->args->cat_name;
	}

	return $replacement;
}