protected function handle_terms( $post_id, $request ) {
		$taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) );
		foreach ( $taxonomies as $taxonomy ) {
			$base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;

			if ( ! isset( $request[ $base ] ) ) {
				continue;
			}
			$terms = array_map( 'absint', $request[ $base ] );
			$result = wp_set_object_terms( $post_id, $terms, $taxonomy->name );
			if ( is_wp_error( $result ) ) {
				return $result;
			}
		}
	}
protected function handle_terms( $post_id, $request ) {
		$taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) );
		foreach ( $taxonomies as $taxonomy ) {
			$base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;

			if ( ! isset( $request[ $base ] ) ) {
				continue;
			}
			$terms = array_map( 'absint', $request[ $base ] );
			$result = wp_set_object_terms( $post_id, $terms, $taxonomy->name );
			if ( is_wp_error( $result ) ) {
				return $result;
			}
		}
	}
protected function handle_terms ( $ post_id , $ request ) { $ taxonomies = wp_list_filter ( get_object_taxonomies ( $ this -> post_type , 'objects' ) , array ( 'show_in_rest' => true ) ) ; foreach ( $ taxonomies as $ taxonomy ) { $ base = ! empty ( $ taxonomy -> rest_base ) ? $ taxonomy -> rest_base : $ taxonomy -> name ; if ( ! isset ( $ request [ $ base ] ) ) { continue ; } $ terms = array_map ( 'absint' , $ request [ $ base ] ) ; $ result = wp_set_object_terms ( $ post_id , $ terms , $ taxonomy -> name ) ; if ( is_wp_error ( $ result ) ) { return $ result ; } } }
Update the post's terms from a REST request.

@param  int             $post_id The post ID to update the terms form.
@param  WP_REST_Request $request The request object with post and terms data.
@return null|WP_Error   WP_Error on an error assigning any of the terms.
Update the post s terms from a REST request .