Yoast\WP\SEO\Helpers

Taxonomy_Helper::get_taxonomy_slug()publicYoast 1.0

Gets the passed taxonomy's slug.

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

Хуков нет.

Возвращает

Строку. The slug for the taxonomy. Returns the taxonomy's name if no slug could be found.

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

$Taxonomy_Helper = new Taxonomy_Helper();
$Taxonomy_Helper->get_taxonomy_slug( $taxonomy );
$taxonomy(строка) (обязательный)
The name of the taxonomy.

Код Taxonomy_Helper::get_taxonomy_slug() Yoast 22.4

public function get_taxonomy_slug( $taxonomy ) {
	$taxonomy_object = \get_taxonomy( $taxonomy );

	if ( $taxonomy_object && \property_exists( $taxonomy_object, 'rewrite' ) && \is_array( $taxonomy_object->rewrite ) && isset( $taxonomy_object->rewrite['slug'] ) ) {
		return $taxonomy_object->rewrite['slug'];
	}

	return \strtolower( $taxonomy_object->name );
}