Change a term
wp_update_termModify an existing taxonomy term’s name, slug, description, or parent by term ID and taxonomy, changing only supplied fields and returning updated status or an error for unknown terms.
Instructions
Change the name, slug, description or parent of an existing term; term_id and taxonomy identify it. Only the fields passed change, the others keep their values. Returns {updated: true, term_id}; an unknown term returns an error. Needs the taxonomy's right to edit terms (for categories and tags: manage_categories) and the right to edit this term (edit_term), which a site can withhold for single terms. Where the permalink structure uses slugs, a new slug changes the URL of the term's archive, and WordPress does not redirect the old one. The term's custom meta is not changed here.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | New display name. When omitted, it stays as it is; an empty name is refused. | |
| slug | No | New URL slug. When omitted, it stays as it is; an empty string derives it from the name, made unique if taken. A slug another term of the taxonomy uses is refused, unless parent changes in the same call (WordPress then makes it unique). | |
| parent | No | Id of the new parent term; 0 moves the term to the top level. A parent that does not exist is refused. When omitted, it stays as it is. | |
| term_id | Yes | Id of the term to change, as wp_list_terms or wp_get_term return it. | |
| taxonomy | Yes | Taxonomy the term belongs to, e.g. "category" or "post_tag". | |
| description | No | New description; an empty string clears it. When omitted, it stays as it is. |