WPSEO_Custom_Taxonomies::get_custom_taxonomies()public staticYoast 1.0

Gets the names of the custom taxonomies, prepends 'ct_' and 'ct_desc', and returns them in an array.

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

Хуков нет.

Возвращает

Массив. The custom taxonomy prefixed names.

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

$result = WPSEO_Custom_Taxonomies::get_custom_taxonomies();

Код WPSEO_Custom_Taxonomies::get_custom_taxonomies() Yoast 22.4

public static function get_custom_taxonomies() {
	// Use cached value if available.
	if ( ! is_null( self::$custom_taxonomies ) ) {
		return self::$custom_taxonomies;
	}

	self::$custom_taxonomies = [];
	$args                    = [
		'public'   => true,
		'_builtin' => false,
	];
	$custom_taxonomies       = get_taxonomies( $args, 'names', 'and' );

	if ( is_array( $custom_taxonomies ) ) {
		foreach ( $custom_taxonomies as $custom_taxonomy ) {
			array_push(
				self::$custom_taxonomies,
				self::add_custom_taxonomies_prefix( $custom_taxonomy ),
				self::add_custom_taxonomies_description_prefix( $custom_taxonomy )
			);
		}
	}

	return self::$custom_taxonomies;
}