Title: wp_insert_term auto unique name
Last modified: August 30, 2016

---

# wp_insert_term auto unique name

 *  [polykrom](https://wordpress.org/support/users/polykrom/)
 * (@polykrom)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_term-auto-unique-name/)
 * Hi,
 * When creating a new term in a custom taxonomy with wp_insert_term, i’ve noticed
   that name should be unique.
    I get a wp error message if it is not : `A term 
   with the name provided already exists with this parent.` I would like a way to
   automatically check if name is already exist and append it if yes.
 * So check :
    `get_term_by('id', $term_id, $taxonomy);` and if term exists append
   the name.
 * but is there a way to auto this with WP ? Like WP does with slug ?
    Why should
   the name be unique, don’t understand as the slug is…
 * thanks a lot !
 * François

The topic ‘wp_insert_term auto unique name’ is closed to new replies.

## Tags

 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)
 * [term](https://wordpress.org/support/topic-tag/term/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [polykrom](https://wordpress.org/support/users/polykrom/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/wp_insert_term-auto-unique-name/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
