The Node has attached two terms.
Term::load($node->get('field_posts_category')->target_id);
only returns first item. How to get all Taxonomy Term attached to Node?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityUse the method referencedEntities()
to get all terms:
$terms = $node->field_posts_category->referencedEntities();