Timeline for How do I get the taxonomy term ID from its name?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Mar 26, 2015 at 0:28 | history | suggested | Paul Sheldrake | CC BY-SA 3.0 |
updated example code to be a bit cleaner
|
Mar 25, 2015 at 23:34 | review | Suggested edits | |||
S Mar 26, 2015 at 0:28 | |||||
Aug 8, 2013 at 0:50 | history | edited | avpaderno♦ | CC BY-SA 3.0 |
added 26 characters in body
|
Jul 10, 2012 at 14:44 | vote | accept | beth | ||
Jul 10, 2012 at 14:44 | history | edited | Jimajamma | CC BY-SA 3.0 |
added 4 characters in body
|
Jul 10, 2012 at 14:42 | comment | added | Jimajamma | I just quickly typed in the D6 version that I am used to. I see now from your links/urls included that you are running D7. The comments above should clarify things for you. | |
Jul 10, 2012 at 14:37 | comment | added | mpdonadio♦ |
@beth, either use the second parameter to limit to a particular vocabulary, or loop through with foreach ($terms as $term) and check the $term->vid to make sure you have the right one.
|
|
Jul 10, 2012 at 14:35 | comment | added | Letharion | It returns an array as there is nothing preventing multiple terms from having the same name. You can't know it's only one item. | |
Jul 10, 2012 at 14:32 | comment | added | beth |
That seems to give me an array rather than a TID. $foo[0]->tid doesn't do anything because it returns an array keyed with TIDs. So to get the TID I need the TID, or to do a foreach() even though it's only on one item? Otherwise: Undefined offset: 0
|
|
Jul 10, 2012 at 14:25 | review | Suggested edits | |||
Jul 10, 2012 at 14:25 | |||||
Jul 10, 2012 at 14:22 | history | answered | Jimajamma | CC BY-SA 3.0 |