public function update( $args, $assoc_args ) {

		list( $taxonomy, $term ) = $args;

		$defaults   = [
			'name'        => null,
			'slug'        => null,
			'description' => null,
			'parent'      => null,
		];
		$assoc_args = wp_parse_args( $assoc_args, $defaults );

		foreach ( $assoc_args as $key => $value ) {
			if ( null === $value ) {
				unset( $assoc_args[ $key ] );
			}
		}

		$assoc_args = wp_slash( $assoc_args );

		$term = get_term_by( Utils\get_flag_value( $assoc_args, 'by' ), $term, $taxonomy );

		if ( ! $term ) {
			WP_CLI::error( "Term doesn't exist." );
		}

		// Update term.
		$result = wp_update_term( $term->term_id, $taxonomy, $assoc_args );

		if ( is_wp_error( $result ) ) {
			WP_CLI::error( $result->get_error_message() );
		} else {
			WP_CLI::success( 'Term updated.' );
		}
	}
public function update( $args, $assoc_args ) {

		list( $taxonomy, $term ) = $args;

		$defaults   = [
			'name'        => null,
			'slug'        => null,
			'description' => null,
			'parent'      => null,
		];
		$assoc_args = wp_parse_args( $assoc_args, $defaults );

		foreach ( $assoc_args as $key => $value ) {
			if ( null === $value ) {
				unset( $assoc_args[ $key ] );
			}
		}

		$assoc_args = wp_slash( $assoc_args );

		$term = get_term_by( Utils\get_flag_value( $assoc_args, 'by' ), $term, $taxonomy );

		if ( ! $term ) {
			WP_CLI::error( "Term doesn't exist." );
		}

		// Update term.
		$result = wp_update_term( $term->term_id, $taxonomy, $assoc_args );

		if ( is_wp_error( $result ) ) {
			WP_CLI::error( $result->get_error_message() );
		} else {
			WP_CLI::success( 'Term updated.' );
		}
	}
public function update ( $ args , $ assoc_args ) { list ( $ taxonomy , $ term ) = $ args ; $ defaults = [ 'name' => null , 'slug' => null , 'description' => null , 'parent' => null , ] ; $ assoc_args = wp_parse_args ( $ assoc_args , $ defaults ) ; foreach ( $ assoc_args as $ key => $ value ) { if ( null === $ value ) { unset ( $ assoc_args [ $ key ] ) ; } } $ assoc_args = wp_slash ( $ assoc_args ) ; $ term = get_term_by ( Utils \ get_flag_value ( $ assoc_args , 'by' ) , $ term , $ taxonomy ) ; if ( ! $ term ) { WP_CLI :: error ( "Term doesn't exist." ) ; } // Update term. $ result = wp_update_term ( $ term -> term_id , $ taxonomy , $ assoc_args ) ; if ( is_wp_error ( $ result ) ) { WP_CLI :: error ( $ result -> get_error_message ( ) ) ; } else { WP_CLI :: success ( 'Term updated.' ) ; } }
Updates an existing term.

## OPTIONS

<taxonomy>
: Taxonomy of the term to update.

<term>
: ID or slug for the term to update.

[--by=<field>]
: Explicitly handle the term value as a slug or id.
---
default: id
options:
- slug
- id
---

[--name=<name>]
: A new name for the term.

[--slug=<slug>]
: A new slug for the term.

[--description=<description>]
: A new description for the term.

[--parent=<term-id>]
: A new parent for the term.

## EXAMPLES

# Change category with id 15 to use the name "Apple"
$ wp term update category 15 --name=Apple
Success: Term updated.

# Change category with slug apple to use the name "Apple"
$ wp term update category apple --by=slug --name=Apple
Success: Term updated.
Updates an existing term .