I wonder if you got any term_links-genre
filters that could be modifying your get_the_term_list()
output?
Your code example should in general work as expected, but you might want to use the get_the_terms()
function to better control the output to your own likings.
Here’s a modifed version of the corresponding Codex example:
/**
* Customized the term list
*
* @param int $pid
* @param string $tax
* @param string $seperator
* @return string $out
*/
function custom_the_term_list( $pid = 0, $tax = 'category', $seperator="," )
{
$out="";
$terms = get_the_terms( $pid, $tax );
if ( $terms && ! is_wp_error( $terms ) ) :
$list = array();
foreach ( $terms as $term )
{
$list[] = $term->name;
}
$out = join( $seperator, $list );
endif;
return $out;
}
Usage example:
printf( '<span class="metaorange">%s</span>',
custom_the_term_list( get_the_id(), 'genre', ',' )
);