public function get_item( $request ) {

		$term = get_term( (int) $request['id'], $this->taxonomy );
		if ( ! $term || $term->taxonomy !== $this->taxonomy ) {
			return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) );
		}
		if ( is_wp_error( $term ) ) {
			return $term;
		}

		$response = $this->prepare_item_for_response( $term, $request );

		return rest_ensure_response( $response );
	}
public function get_item( $request ) {

		$term = get_term( (int) $request['id'], $this->taxonomy );
		if ( ! $term || $term->taxonomy !== $this->taxonomy ) {
			return new WP_Error( 'rest_term_invalid', __( "Resource doesn't exist." ), array( 'status' => 404 ) );
		}
		if ( is_wp_error( $term ) ) {
			return $term;
		}

		$response = $this->prepare_item_for_response( $term, $request );

		return rest_ensure_response( $response );
	}
public function get_item ( $ request ) { $ term = get_term ( ( int ) $ request [ 'id' ] , $ this -> taxonomy ) ; if ( ! $ term || $ term -> taxonomy !== $ this -> taxonomy ) { return new WP_Error ( 'rest_term_invalid' , __ ( "Resource doesn't exist." ) , array ( 'status' => 404 ) ) ; } if ( is_wp_error ( $ term ) ) { return $ term ; } $ response = $ this -> prepare_item_for_response ( $ term , $ request ) ; return rest_ensure_response ( $ response ) ; }
Gets a single term from a taxonomy.

@param WP_REST_Request $request Full details about the request
@return WP_REST_Request|WP_Error
Gets a single term from a taxonomy .