public function set( $args, $assoc_args ) {
		$object_id = array_shift( $args );
		$taxonomy  = array_shift( $args );
		$terms     = $args;

		$this->set_obj_id( $object_id );

		$this->taxonomy_exists( $taxonomy );

		$field = Utils\get_flag_value( $assoc_args, 'by' );
		if ( $field ) {
			$terms = $this->prepare_terms( $field, $terms, $taxonomy );
		}
		$result = wp_set_object_terms( $object_id, $terms, $taxonomy, false );

		$label = count( $terms ) > 1 ? 'terms' : 'term';
		if ( ! is_wp_error( $result ) ) {
			WP_CLI::success( "Set {$label}." );
		} else {
			WP_CLI::error( "Failed to set {$label}." );
		}
	}
public function set( $args, $assoc_args ) {
		$object_id = array_shift( $args );
		$taxonomy  = array_shift( $args );
		$terms     = $args;

		$this->set_obj_id( $object_id );

		$this->taxonomy_exists( $taxonomy );

		$field = Utils\get_flag_value( $assoc_args, 'by' );
		if ( $field ) {
			$terms = $this->prepare_terms( $field, $terms, $taxonomy );
		}
		$result = wp_set_object_terms( $object_id, $terms, $taxonomy, false );

		$label = count( $terms ) > 1 ? 'terms' : 'term';
		if ( ! is_wp_error( $result ) ) {
			WP_CLI::success( "Set {$label}." );
		} else {
			WP_CLI::error( "Failed to set {$label}." );
		}
	}
public function set ( $ args , $ assoc_args ) { $ object_id = array_shift ( $ args ) ; $ taxonomy = array_shift ( $ args ) ; $ terms = $ args ; $ this -> set_obj_id ( $ object_id ) ; $ this -> taxonomy_exists ( $ taxonomy ) ; $ field = Utils \ get_flag_value ( $ assoc_args , 'by' ) ; if ( $ field ) { $ terms = $ this -> prepare_terms ( $ field , $ terms , $ taxonomy ) ; } $ result = wp_set_object_terms ( $ object_id , $ terms , $ taxonomy , false ) ; $ label = count ( $ terms ) > 1 ? 'terms' : 'term' ; if ( ! is_wp_error ( $ result ) ) { WP_CLI :: success ( "Set {$label}." ) ; } else { WP_CLI :: error ( "Failed to set {$label}." ) ; } }
Set object terms.

Replaces existing terms on the object.

<id>
: The ID of the object.

<taxonomy>
: The name of the taxonomy type to be updated.

<term>...
: The slug of the term or terms to be updated.

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