Hello,
I resolved the problem with one simple modification of the above function:
function get_taxonomy_terms_array($taxonomy_type) {
$terms = get_terms(array(
'taxonomy' => $taxonomy_type,
'orderby' => 'slug',
'order' => 'ASC',
'hide_empty' => false,
));
$key_label_array = array();
foreach ($terms as $term) {
$key_label_array[$term->slug] = $term->name;
}
return $key_label_array;
}
In this updated version of the function, the orderby argument is set to ‘slug’, which will sort the terms by the slug property in ascending order (as specified by the order argument). The sorting of the $key_label_array is no longer needed since the terms are already sorted by slug.
Thank you for the support!!!