Clone a node programmatically
In Drupal 8, any entity can be cloned using EntityInterface::createDuplicate(). So in the case of your node object: $cloned_node = $node-&gt;createDuplicate(). Calling $cloned_node-&gt;save() will save a new node with a different ID.