How to save meta tags to your node programmatically

When importing content, it is really important you also think about meta tags on your import. Here's how to save them to nodes.

$node->set('field_meta_tags', serialize([
  'title' => $title,
  'description' => $description,
]));

 

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!