How do you extract the url from :

$url = get_the_term_list($post->ID, 'nom-origin')

I have tried many things but i just don’t get it. The only solution i got was this but i know it’s just too messy :

$url = get_the_term_list($post->ID, 'nom-origin');//,'<h3>Job Category:</h3> ', ', ', '' );
$url_tmp1 = explode("href=\"",$url);
$url_tmp2 = explode("\" rel=\"tag\">",$url_tmp1[1]);
$url_simple = $url_tmp2[0];

2 Answers
2

get_term_link gives you the link of a particular taxonomy term.

$terms = get_object_terms( $post->ID, 'nom-origin' );
$urls = array();
foreach( $terms as $term )
{
    $url[] = get_term_link( $term->slug, 'nom-origin' );
    //Or do whatever you want here with the url
}

Leave a Reply

Your email address will not be published. Required fields are marked *