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

inticleni (not verified)

cbd vape http://buycbdoilwalm.com/ - best cbd oil medterra cbd medterra cbd cbd oils

inticleni (not verified)

cbd vape http://buycbdoilwalm.com/ - best cbd oil medterra cbd medterra cbd cbd oils

inticleni (not verified)

buy cbd oil online http://buycbdoilwalm.com/ hemp cbd cbd oil for sale cbd vape

erection pills ... (not verified)

Qceqmm ybhjrs mens erection pills ed pills for sale

erection pills ... (not verified)

Qceqmm ybhjrs mens erection pills ed pills for sale

inticleni (not verified)

cbd oil store http://buycbdoilonline.us.com/ - buy cbd cbd tinctures cbd oil online buy cbd oil online

enetibliole (not verified)

http://cbdoilrx.us.com/ hemp oil cbd oil online buy cbd oil online cbd tinctures

enetibliole (not verified)

http://cbdoilrx.us.com/ hemp oil cbd oil online buy cbd oil online cbd tinctures

inticleni (not verified)

cbd online http://buycbdoilonline.us.com/ - cannabis oil buy cbd cbd oil benefits cbd oil for sale

inticleni (not verified)

cbd online http://buycbdoilonline.us.com/ - cannabis oil buy cbd cbd oil benefits cbd oil for sale

enetibliole (not verified)

http://cbdoilrx.us.com/ cbd oils http://cbdoilrx.us.com/ - cbd pills cbd oil store

enetibliole (not verified)

http://cbdoilrx.us.com/ cbd oils http://cbdoilrx.us.com/ - cbd pills cbd oil store

inticleni (not verified)

cbd medic http://buycbdoilonline.us.com/ - cbd drops cbd drops cbd products

inticleni (not verified)

buy cbd oil online http://buycbdoilonline.us.com/ - cbd capsules cbd gummies cbd hemp

inticleni (not verified)

cbd capsules cbd for sale cbd oil benefits

inticleni (not verified)

buy cbd oil http://buycbdoilonline.us.com/ - cbd products cbd tinctures cbd oil

ed pills gnc (not verified)

Ojgzlq rvtvqp cheap ed pills generic ed pills

buy ed pills (not verified)

Xmoigp urudkg cheap ed pills male erection pills

erectile dysfun... (not verified)

Hsaijl odejub best ed pills online ed meds online without doctor prescription

gnc ed pills (not verified)

Wzexqk srdmlo cialis canada buy ed pills online

Estherchera (not verified)

Cltzxc keajcl Buy viagra Viagra mail order us

bisding (not verified)

buy cialis ebay find tadalafil https://abcialisnews.com/ - Cialis cialis and norvasc Cialis Buy Super P Force Pills

Estherchera (not verified)

Bceobl avpogs online canadian pharmacy online canadian pharmacy

Estherchera (not verified)

Bceobl avpogs online canadian pharmacy online canadian pharmacy

Estherchera (not verified)

Tfbsjj ijpvbu canada pharmacy best online pharmacy

Estherchera (not verified)

Tfbsjj ijpvbu canada pharmacy best online pharmacy

Estherchera (not verified)

Lvcacj ioomvz pharmacy online walmart pharmacy

Estherchera (not verified)

Lvcacj ioomvz pharmacy online walmart pharmacy

bisding (not verified)

Cialis Cancer De La Prostate https://buycialisuss.com/ - buying cialis online forum Kamagra Oral Jelly Levitra Buy Cialis Viagra Vancouver

Estherchera (not verified)

Yufdgu klmgqr generic viagra online Buy viagra

Estherchera (not verified)

Qkjhfq zbwept Get viagra Sale viagra

Estherchera (not verified)

Bikmaq jgafpw viagra online Order viagra us

Estherchera (not verified)

Bikmaq jgafpw viagra online Order viagra us

Estherchera (not verified)

Pzgaew yzebvm Drug viagra canada pharmacy

Estherchera (not verified)

Pzgaew yzebvm Drug viagra canada pharmacy

Estherchera (not verified)

Oqnort wvggse generic cialis walmart pharmacy

Estherchera (not verified)

Oqnort wvggse generic cialis walmart pharmacy

Estherchera (not verified)

Cxjkmr brnkcf generic cialis online pharmacy online

phefewedy (not verified)

Buy Cialis Online Cheap https://cheapcialisll.com/ - Cheap Cialis How To Use Kamagra Tablets Cialis Caracteristicas Del Propecia

Estherchera (not verified)

Niuzxl gpjxod Get cialis canada online pharmacy

Estherchera (not verified)

Wzfyxb brrdkf Cialis pharmacy online online canadian pharmacy

Estherchera (not verified)

Wzfyxb brrdkf Cialis pharmacy online online canadian pharmacy

Discount viagra... (not verified)

Ivhqlv iankgp vardenafil generic

Buy brand viagra (not verified)

Hylywe mxdleg vardenafil 20mg

Levitra vs viagra (not verified)

Gdrjos xidjlt order vardenafil ed meds online without doctor prescription

Canada meds viagra (not verified)

Fqoldm iyfpvd kamagra online india erection pills

Generic viagra (not verified)

Rpbmbv wfimma casino online real money free slots

Generic viagra (not verified)

Rpbmbv wfimma casino online real money free slots

Levitra vs viagra (not verified)

Hbrqjx viriie levitra online canadian pharmacy

phefewedy (not verified)

Viagra Free Delivery [url=https://agenericcialise.com/]Generic Cialis[/url] Mantreal Cialas Commercial Cialis Viagra Professional 200 Canada Pharmacy

Add new comment