wp_update_term
wp_update_term ( $term_id, $taxonomy, $args = array() )
Parameters:- (int) term_id The ID of the term.
- (string) taxonomy The taxonomy of the term.
- (array) args { Optional. Array of arguments for updating a term. @type string $alias_of Slug of the term to make this term an alias of. Default empty string. Accepts a term slug. @type string $description The term description. Default empty string. @type int $parent The id of the parent term. Default 0. @type string $slug The term slug to use. Default empty string. }
Returns:- (array|WP_Error) An array containing the `term_id` and `term_taxonomy_id`, WP_Error otherwise.
Defined at: - Introduced in WordPress: 2.3.0
- Deprecated in WordPress: —
Description
Updates term based on arguments provided.The `$args` will indiscriminately override all values with the same field name.
Care must be taken to not override important information need to update or
update will fail (or perhaps create a new term, neither would be acceptable).
Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not
defined in `$args` already.
'alias_of' will create a term group, if it doesn't already exist, and
update it for the `$term`.
If the 'slug' argument in `$args` is missing, then the 'name' will be used.
If you set 'slug' and it isn't unique, then a WP_Error is returned.
If you don't pass any slug, then a unique one will be created.