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

snaxLiny (not verified)

cancel fast web amsterdam prosecutor

snaxLiny (not verified)

cancel fast web amsterdam prosecutor

Jndqweack (not verified)

[url=https://50cialmen.com/]cialis half life[/url] [url=https://aazmencial.com/]do you need a prescription for cialis[/url] [url=https://joicialviaed.com/]cialis shipped from usa[/url]

Llpweack (not verified)

[url=https://60lmentop.com/]viagra commercial 2016[/url] [url=https://viamengo.com/]canada pharmacy viagra[/url] [url=https://didoviamen.com/]sildenafil vs viagra[/url]

StevenNut (not verified)
Fbshweack (not verified)

[url=https://thesisacloud.com/]thesis research[/url] thesis service write a thesis how to write a phd thesis

LecfReest (not verified)

[url=https://hopeviagrin.com/]benefits of viagra for men[/url] [url=https://lightvigra.com/]can you drink alcohol with viagra[/url] [url=https://xuypharmacyonline.com/]healthcare alliance pharmacy discount card[/url] [url=https://online21rxon.com/]pharmacy solutions[/url] [url=https://happyrxpharmacy21.com/]how much does a pharmacy tech make[/url] [url=https://storerxpharmcanada.com/]nearest pharmacy to me[/url]

Abgcweack (not verified)

[url=https://thesiswritingtob.com/]thesis software[/url] phd thesis database best thesis writing service help with thesis statements

Brfgmodo (not verified)

[url=https://ljcialishe.com/]free cialis sample pack[/url] [url=https://cialisvja.com/]cialis black[/url] [url=https://viagraonlinejc.com/]mexican viagra brands[/url] [url=https://viagratx.com/]herb viagra green box[/url] [url=https://buycialisxz.com/]what is the difference between viagra and cialis[/url]

KedReest (not verified)

[url=https://qqllviagria.com/]whats in viagra[/url] [url=https://ssviagriia.com/]buying viagra online[/url] [url=https://canadianpharmnorx.com/]cvs specialty pharmacy[/url] [url=https://ggviagll.com/]viagra substitute[/url] [url=https://viagerkr.com/]viagra boys[/url] [url=https://viagriyvik.com/]buy generic viagra online[/url]

Jndqweack (not verified)

[url=https://50cialmen.com/]how to avoid cialis side effects\[/url] [url=https://aazmencial.com/]effects of cialis[/url] [url=https://joicialviaed.com/]superman combo viagra cialis[/url]

Grvamaps (not verified)

[url=https://kloviagrli.com/]online prescription for viagra[/url] [url=https://vigedon.com/]is there a generic for viagra[/url] [url=https://llecialisjaw.com/]does cialis lowers blood pressure[/url] [url=https://jwcialislrt.com/]cialis online pharmacy[/url] [url=https://jecialisbn.com/]viagra vs cialis forum[/url]

Grvamaps (not verified)

[url=https://kloviagrli.com/]online prescription for viagra[/url] [url=https://vigedon.com/]is there a generic for viagra[/url] [url=https://llecialisjaw.com/]does cialis lowers blood pressure[/url] [url=https://jwcialislrt.com/]cialis online pharmacy[/url] [url=https://jecialisbn.com/]viagra vs cialis forum[/url]

LecfReest (not verified)

[url=https://hopeviagrin.com/]what is viagra[/url] [url=https://lightvigra.com/]viagra canada[/url] [url=https://xuypharmacyonline.com/]pharmacy technician requirements[/url] [url=https://online21rxon.com/]my humana pharmacy[/url] [url=https://happyrxpharmacy21.com/]park pharmacy[/url] [url=https://storerxpharmcanada.com/]rite aid pharmacy hours[/url]

Jndqweack (not verified)

[url=https://50cialmen.com/]50cialmen.com[/url] [url=https://aazmencial.com/]aazmencial.com[/url] [url=https://joicialviaed.com/]joicialviaed.com[/url]

KedReest (not verified)

[url=https://qqllviagria.com/]qqllviagria.com[/url] [url=https://ssviagriia.com/]ssviagriia.com[/url] [url=https://canadianpharmnorx.com/]canadianpharmnorx.com[/url] [url=https://ggviagll.com/]ggviagll.com[/url] [url=https://viagerkr.com/]viagerkr.com[/url] [url=https://viagriyvik.com/]viagriyvik.com[/url]

Llpweack (not verified)

[url=https://60lmentop.com/]60lmentop.com[/url] [url=https://viamengo.com/]viamengo.com[/url] [url=https://didoviamen.com/]didoviamen.com[/url]

AnthonyRof (not verified)

Полноценное продвижение сайтов в ТОП 10 по Москве и России от https://seo-bro.ru/ - Услуги по раскрутке сайтов в Яндекс, Google от частного SEO специалиста с кейсами!

Seo москва по низким ценам!

LecfReest (not verified)

[url=https://hopeviagrin.com/]hopeviagrin.com[/url] [url=https://lightvigra.com/]lightvigra.com[/url] [url=https://xuypharmacyonline.com/]xuypharmacyonline.com[/url] [url=https://online21rxon.com/]online21rxon.com[/url] [url=https://happyrxpharmacy21.com/]happyrxpharmacy21.com[/url] [url=https://storerxpharmcanada.com/]storerxpharmcanada.com[/url]

KedReest (not verified)

[url=https://qqllviagria.com/]qqllviagria.com[/url] [url=https://ssviagriia.com/]ssviagriia.com[/url] [url=https://canadianpharmnorx.com/]canadianpharmnorx.com[/url] [url=https://ggviagll.com/]ggviagll.com[/url] [url=https://viagerkr.com/]viagerkr.com[/url] [url=https://viagriyvik.com/]viagriyvik.com[/url]

Jndqweack (not verified)

[url=https://50cialmen.com/]50cialmen.com[/url] [url=https://aazmencial.com/]aazmencial.com[/url] [url=https://joicialviaed.com/]joicialviaed.com[/url]

Add new comment