Yoast\WP\SEO\Dashboard\Application\Taxonomies

Taxonomies_Repository::get_content_type_taxonomy()publicYoast 1.0

Returns the object of the filtering taxonomy of a content type.

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

Хуков нет.

Возвращает

Taxonomy|null. The filtering taxonomy of the content type.

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

$Taxonomies_Repository = new Taxonomies_Repository();
$Taxonomies_Repository->get_content_type_taxonomy( $content_type );
$content_type(строка) (обязательный)
The content type that the taxonomy filters.

Код Taxonomies_Repository::get_content_type_taxonomy() Yoast 24.4

public function get_content_type_taxonomy( string $content_type ) {
	// First we check if there's a filter that overrides the filtering taxonomy for this content type.
	$taxonomy = $this->taxonomies_collector->get_custom_filtering_taxonomy( $content_type );
	if ( $taxonomy ) {
		return $taxonomy;
	}

	// Then we check if there is a filter explicitly made for this content type.
	$taxonomy = $this->filter_pairs_repository->get_taxonomy( $content_type );
	if ( $taxonomy ) {
		return $taxonomy;
	}

	// If everything else returned empty, we can always try the fallback taxonomy.
	return $this->taxonomies_collector->get_fallback_taxonomy( $content_type );
}