How to load taxonomy term by name in Drupal 8

Posted by admin on Fri, 01/19/2018 - 14:57

Code snippet to load taxonomy term by name (or any otehr property) in Drupal 8.

$term_name = 'Your Term Name';
$term = \Drupal::entityTypeManager()
      ->getStorage('taxonomy_term')
      ->loadByProperties(['name' => $term_name]);

If you want to use vid and name - just add that to properties array like this:

$term_name = 'Your Term Name';
$vid = 3;
$term = \Drupal::entityTypeManager()
      ->getStorage('taxonomy_term')
      ->loadByProperties(['name' => $term_name, 'vid' => $vid]);
×

Hey! Don't miss a new cool stuff!

Comments

Jebgweack (not verified)

Atorlip-5 [url=https://pharmacylo.com/ ]drugstore online shopping[/url] Malegra FXT plus

RebfReest (not verified)

soft gel cialis [url=https://rcialisgl.com/ ]next day delivery cialis[/url] overnight cialis delivery

weackHtf (not verified)

20 mg cialis not working [url=https://cialishav.com/ ]cialis on ebay[/url] cialis coupon cvs

weackDev (not verified)

rx one pharmacy [url=https://cjepharmacy.com/ ]canadianpharmacy com[/url] where to dispose of prescription drugs

modoSwa (not verified)

order generic cialis by phone [url=https://ckacialis.com/ ]cialis generic vs brand[/url] generic cialis cheap

weackAni (not verified)

viagra pharmacy 100mg [url=https://pharmacyken.com/ ]can i bring prescription drugs in my carry on[/url] canadian pharmacies list

weackGtv (not verified)

legitimate mexican pharmacy online [url=https://pharmacyhrn.com/ ]pharmacy school in canada[/url] online pharmacy in india

ReestVed (not verified)

what is the dosage for cialis [url=https://krocialis.com/ ]cialis vs cialis professional[/url] cialisfree pills

Reestloh (not verified)

does generic cialis work? [url=https://rcialisgl.com/ ]coupon for cialis[/url] when will generic cialis be available

weackHtf (not verified)

cialis 20mg ???? [url=https://cialishav.com/ ]cialis $200 savings card[/url] cialis forum

modoSwa (not verified)

viagra cialis trial pack [url=https://ckacialis.com/ ]cialis without prescriptions[/url] free cialis

weackAni (not verified)

rules for taking prescription drugs on airplane [url=https://pharmacyken.com/ ]canadian pharmacy florida[/url] bernie sanders canada drugs

lalfecome (not verified)

cialis 20mg[/url]

weackHtf (not verified)

cialis free samples [url=https://cialishav.com/ ]cialis canada[/url] no prescription cialis

weackAni (not verified)

world pharmacy rx [url=https://pharmacyken.com/ ]precision rx pharmacy[/url] viagra canadian online pharmacy

Anonymous (not verified)

https://www.ekffo150.com/theking
https://www.ekffo150.com/merit
https://www.ekffo150.com/yes
https://www.ekffo150.com/first
https://www.ekffo150.com/sands
https://www.ekffo150.com/joy
https://www.ekffo150.com/royal
https://www.ekffo150.com/starclub
https://www.ekffo150.com/asian
https://www.ekffo150.com/superman
https://www.ekffo150.com/gatsby
https://www.ekffo150.com/33
https://www.ekffo150.com/oncasino
https://www.ekffo150.com

https://www.ajp4949.com/theking
https://www.ajp4949.com/merit
https://www.ajp4949.com/sands
https://www.ajp4949.com/first
https://www.ajp4949.com/33casino
https://www.ajp4949.com/worldcasino
https://www.ajp4949.com/korea
https://www.ajp4949.com/

https://www.bgj4949.com/
https://www.bgj4949.com/sands
https://www.bgj4949.com/theking
https://www.bgj4949.com/first
https://www.bgj4949.com/yes
https://www.bgj4949.com/33
https://www.bgj4949.com/world
https://www.bgj4949.com/super
https://www.bgj4949.com/korea
https://www.bgj4949.com/gatsby

https://www.dnfl4949.com/
https://www.dnfl4949.com/first
https://www.dnfl4949.com/merit
https://www.dnfl4949.com/theking
https://www.dnfl4949.com/sands
https://www.dnfl4949.com/yescasino
https://www.dnfl4949.com/gatsby
https://www.dnfl4949.com/corea
https://www.dnfl4949.com/33casino
https://www.dnfl4949.com/f1casino

https://www.skfl4949.com/
https://www.skfl4949.com/firstcasino
https://www.skfl4949.com/meritcasino
https://www.skfl4949.com/sandscasino
https://www.skfl4949.com/thekingcasino
https://www.skfl4949.com/yescasino
https://www.skfl4949.com/gatsbycasino

lalfecome (not verified)

buying cialis online

lalfecome (not verified)

kamagra 100 online

WilliamArgug (not verified)

free dating near you
[url="http://onlinedatingtwo.com/?"]teresa earnhardt dating black man[/url]

Add new comment