| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/HostingSpaces/admin/tickwaves.co.uk/wwwroot/wp-content/themes/blocksy/inc/helpers/ |
Upload File : |
<?php
function blocksy_get_taxonomies_for_cpt($post_type, $args = []) {
$args = wp_parse_args($args, [
'return_empty' => false
]);
if ($post_type === 'product') {
return [
'product_cat' => __('Category', 'blocksy'),
'product_tag' => __('Tag', 'blocksy')
];
}
$result = [];
$taxonomies = array_values(array_diff(
get_object_taxonomies($post_type),
['post_format']
));
if (count($taxonomies) === 0) {
if ($args['return_empty']) {
return [];
}
return [
'default' => __('Default', 'blocksy')
];
}
foreach ($taxonomies as $single_taxonomy) {
$taxonomy_object = get_taxonomy($single_taxonomy);
$result[$single_taxonomy] = $taxonomy_object->label;
}
return $result;
}