Yoast\WP\SEO\Dashboard\Infrastructure\Taxonomies

Taxonomies_Collector::get_custom_filtering_taxonomy()publicYoast 1.0

Returns a custom pair of taxonomy/content type, that's been given by users via hooks.

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

Хуки из метода

Возвращает

Taxonomy|null. The hooked filtering taxonomy.

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

$Taxonomies_Collector = new Taxonomies_Collector();
$Taxonomies_Collector->get_custom_filtering_taxonomy( $content_type );
$content_type(строка) (обязательный)
The content type we're hooking for.

Код Taxonomies_Collector::get_custom_filtering_taxonomy() Yoast 24.4

public function get_custom_filtering_taxonomy( string $content_type ) {
	/**
	 * Filter: 'wpseo_{$content_type}_filtering_taxonomy' - Allows overriding which taxonomy filters the content type.
	 *
	 * @internal
	 *
	 * @param string $filtering_taxonomy The taxonomy that filters the content type.
	 */
	$filtering_taxonomy = \apply_filters( "wpseo_{$content_type}_filtering_taxonomy", '' );
	if ( $filtering_taxonomy !== '' ) {
		$taxonomy = $this->get_taxonomy( $filtering_taxonomy, $content_type );

		if ( $taxonomy ) {
			return $taxonomy;
		}

		\_doing_it_wrong(
			'Filter: \'wpseo_{$content_type}_filtering_taxonomy\'',
			'The `wpseo_{$content_type}_filtering_taxonomy` filter should return a public taxonomy, available in REST API, that is associated with that content type.',
			'YoastSEO v24.1'
		);
	}

	return null;
}