The Node has attached two terms.

enter image description here

Term::load($node->get('field_posts_category')->target_id); only returns first item. How to get all Taxonomy Term attached to Node?


Use the method referencedEntities() to get all terms:

$terms = $node->field_posts_category->referencedEntities();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.