I solved it, here is the code if anyone has a similar problem
add_filter('wpc_terms_before_display', 'wpc_sort_terms_by_vodootpornost', 10, 4);
function wpc_sort_terms_by_vodootpornost($terms, $filter, $set, $urlManager) {
// Provjerite da li je filter za ?eljenu taxonomy
if ($filter['e_name'] === 'vodootpornost_tax') {
$newTerms = [];
foreach ($terms as $term) {
// Ekstrahirajte numeri?ku vrijednost iz naziva termina (npr. "10 bara")
preg_match('/(\d+) bara/', $term->name, $match);
$term->menu_order = isset($match[1]) ? intval($match[1]) : 0;
$newTerms[] = $term;
}
// Sortiranje u rastu?em redoslijedu
usort($newTerms, function($a, $b) {
return $a->menu_order - $b->menu_order;
});
return $newTerms;
}
return $terms;
}