Hi there,
WPML will auto-generate the slug only if the slug field is empty when translating taxonomies in WPML > Taxonomy Translation. The wpml_generate_term_slug action relies on WordPress core functions to create a unique slug within the same taxonomy.
In your case, it sounds like the duplicates may come from a different content type (e.g., pages), and because you’ve removed the taxonomy base, WordPress might have trouble resolving the correct URL on the frontend (for example, domain.com/shoes could point to either a page about shoes or a product category named “shoes”).
This is a known issue when removing bases, as it can lead to URL conflicts/duplication. The best approach is to make sure slugs are unique across all content.
I wouldn’t recommend modifying wpml_generate_term_slug directly. Instead, you can look at WordPress core functions and filters such as pre_term_slug or wp_unique_term_slug to build a custom slug. I’d also suggest using understandable prefixes/suffixes rather than random IDs, to create user-firendly and SEO-friendly URLs.
Last, please note that the issue is related to translations (WPML), so feel free to open a ticket on our support forum, as WordPress.org has a no commercial plugin policy.