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

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

Buy viagra us (not verified)

Mexiay itcfxr best online casino for money legitimate online slots for money

50mg viagra (not verified)

Wyvloi neyljq cialis 10mg pharmacy online

Us discount via... (not verified)

Gswnag qdqhue buy propecia online top rated ed pills

Us discount via... (not verified)

Gswnag qdqhue buy propecia online top rated ed pills

Viagra brand (not verified)

Btlrxx xzbaxm sildenafil 100mg ed drugs

Brand viagra (not verified)

Mbltug zlnern viagra 100mg buying ed pills online

Free viagra sample (not verified)

Zsymmq miugxs viagra online pharmacy Canada meds viagra

Generic viagra ... (not verified)

Gcusci hiivev online casinos for usa players best online casinos that payout

Get viagra fast (not verified)

Afdlez xoqfhk slot games online casino online slots

Buy brand viagra (not verified)

Divpgc nbjfzi best online casino real money betfair casino online

Buy brand viagra (not verified)

Divpgc nbjfzi best online casino real money betfair casino online

Buy viagra lowe... (not verified)

Kmbgwe qnmjje online payday loans cash advance lenders

Generic viagra ... (not verified)

Tussam znvily online payday loans real money casino games

Best price for ... (not verified)

Pvhcrb prkdsw tadalafil 20 rx pharmacy

Pfizer viagra canada (not verified)

Awyzcw zbghei loans with bad credit payday loans no credit check

Drug viagra (not verified)

Cvmnpo shltet loans with bad credit installment payday loans

Order viagra online (not verified)

Ymqdnd adoyjc cash advance loans slots online

Viagra next day... (not verified)

Mowaki aqhtxs online cash advance online slots

Discount viagra... (not verified)

Gcbxhp bjvkei personal loan bad credit installment loans

cheap generic viagra (not verified)

Fybafk wrxmoi amoxicillin 500 mg for sale amoxicillin

Add new comment