WPSEO_Custom_Taxonomies::get_custom_taxonomies
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() WPSEO Custom Taxonomies::get custom taxonomies Yoast 27.6
public static function get_custom_taxonomies() {
// Use cached value if available.
if ( self::$custom_taxonomies !== null ) {
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;
}