public function add_term( $args, $assoc_args ) {

		$assoc_args['object'] = $args[1];
		unset( $args[1] );
		$assoc_args['object-id'] = $args[2];
		unset( $args[2] );

		if ( ! get_term_by( 'id', $assoc_args['object-id'], $assoc_args['object'] ) ) {
			WP_CLI::error( 'Invalid term.' );
		}

		$this->add_or_update_item( 'add', 'taxonomy', $args, $assoc_args );
	}
public function add_term( $args, $assoc_args ) {

		$assoc_args['object'] = $args[1];
		unset( $args[1] );
		$assoc_args['object-id'] = $args[2];
		unset( $args[2] );

		if ( ! get_term_by( 'id', $assoc_args['object-id'], $assoc_args['object'] ) ) {
			WP_CLI::error( 'Invalid term.' );
		}

		$this->add_or_update_item( 'add', 'taxonomy', $args, $assoc_args );
	}
public function add_term ( $ args , $ assoc_args ) { $ assoc_args [ 'object' ] = $ args [ 1 ] ; unset ( $ args [ 1 ] ) ; $ assoc_args [ 'object-id' ] = $ args [ 2 ] ; unset ( $ args [ 2 ] ) ; if ( ! get_term_by ( 'id' , $ assoc_args [ 'object-id' ] , $ assoc_args [ 'object' ] ) ) { WP_CLI :: error ( 'Invalid term.' ) ; } $ this -> add_or_update_item ( 'add' , 'taxonomy' , $ args , $ assoc_args ) ; }
Adds a taxonomy term as a menu item.

## OPTIONS

<menu>
: The name, slug, or term ID for the menu.

<taxonomy>
: Taxonomy of the term to be added.

<term-id>
: Term ID of the term to be added.

[--title=<title>]
: Set a custom title for the menu item.

[--link=<link>]
: Set a custom url for the menu item.

[--description=<description>]
: Set a custom description for the menu item.

[--attr-title=<attr-title>]
: Set a custom title attribute for the menu item.

[--target=<target>]
: Set a custom link target for the menu item.

[--classes=<classes>]
: Set a custom link classes for the menu item.

[--position=<position>]
: Specify the position of this menu item.

[--parent-id=<parent-id>]
: Make this menu item a child of another menu item.

[--porcelain]
: Output just the new menu item id.

## EXAMPLES

$ wp menu item add-term sidebar-menu post_tag 24
Success: Menu item added.

@subcommand add-term
Adds a taxonomy term as a menu item .