Retrieve a post’s terms as a list with specified format.

Signature

get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' )
id
 (int) Post ID.
taxonomy
 (string) Taxonomy name.
before
 (string) Optional. Before list.
Default: ''
sep
 (string) Optional. Separate items using this.
Default: ''
after
 (string) Optional. After list.
Default: ''

Return

(string|false|WP_Error) A list of terms on success, false if there are no terms, WP_Error on failure.

Source

function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
	$terms = get_the_terms( $id, $taxonomy );

	if ( is_wp_error( $terms ) )
		return $terms;

	if ( empty( $terms ) )
		return false;

	$links = array();

	foreach ( $terms as $term ) {
		$link = get_term_link( $term, $taxonomy );
		if ( is_wp_error( $link ) ) {
			return $link;
		}
		$links[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
	}

	/**
13 more lines...
WP Trac GitHub

Link here