I have a content type book and it has two taxonomy term reference fields (free tagging, autocomplete):

  • author
  • publisher

Both two taxonomy reference fields have taxonomy terms from the same vocabulary: people.

While creating new book content, if I enter the same taxonomy term for both author and publisher, it double creates the same taxonomy term (if entered taxonomy term didn't exist before).

I don't want to use different vocabularies for these taxonomy reference fields.

How to prevent taxonomy terms being duplicated on node form?

  • Why not use two vocabularies if their context is different? It seems odd to add multiple reference fields pointing at one vocab, but want it to act like one field with multiple labels.
    – Kevin
    Mar 7, 2016 at 12:41
  • No, their context is not different as you thought. Sometimes one author of a content can be publisher of another. I want to use the same vocabulary for purposes: to use same name db for autocomplete, to create some views for content related to each person etc. If I use two separate vocabulary it will be useless. Thanks for your comment.
    – herci
    Mar 7, 2016 at 12:56

2 Answers 2


Though there is a module for help with taxonomy term being duplicate here, but like module page says, it doesn't work apart from taxonomy term and vocabulary forms.

So a solution I can think of in your scenario is to use hook_node_presave and compare value of both fields. If it match, you can think of some logic such as, create single term & set newly created tag for both fields.

Other hook can also help you such as hook_node_insert with your own logic to tackle this. Happy Coding !!

  • Thanks, I know the Taxonomoy Dupecheck module but it doesn't do what I want (because of node form).
    – herci
    Mar 7, 2016 at 12:57
  • 1
    @herci - I also mentioned it in answer. Try it with writing some lines of code & I am sure you will succeed.
    – RajeevK
    Mar 7, 2016 at 13:35

If you are using rules already, you could check if the term names are the same on node save. Conditions: Entity has field x 2 and Data comparison.

Then use actions to delete a term and set that field again with the other.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.