my problem is that I've imported in wordpress some hundreds of terms of a custom taxonomy, from another system, in 5 languages. I've found out those terms have sometimes duplicated slugs, and they're not allowed.

I could fix them by hand, but it would take too much time. So I'm trying to find the quickest way to programmatically:

  • find the terms which have duplicated slugs
  • fix them

One way, without first find duplicates, I think would be to just use get_terms to get all the terms and then cicle them and update them without any parameter > the slug should be automatically fixed > that's what happens if you open a term edit page and just click the update button: if the slug was a duplicated one, it will be auto-fixed.

Ok fine. Is there any other smarter way? Maybe some dedicated wordpress function to find duplicated slugs or so... ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.