Kooki3
Kooki3

Reputation: 609

Getting taxanomy value from URL

I'm setting up a search page by views exposed filter. And one of the field are filter by taxonomy term.

For example, when I search with the taxonomy term filter field, the URL is like below.

domain.com/search?subjects=69

Now I wish to get the value of the taxonomy (it's showing tid instead of value)

<?php
$idenity = $_GET['subjects'];
print $idenity;
?>

Anyway to get the value of the taxonomy value but not taxonomy id?

Upvotes: 0

Views: 124

Answers (1)

Sleavely
Sleavely

Reputation: 1693

You didn't specify which version you're using so I'm assuming Drupal 7 because it's the latest stable version.

You can load the term with taxonomy_term_load():

<?php
$tid = intval($_GET['subjects']);
$term = taxonomy_term_load($tid)
print $term->name;
?>

Personally, I find that the comments on the Drupal API site are usually very helpful in understanding how to use functions that sound like they are relevant to my problem.

Upvotes: 0

Related Questions