Load a Node by Title in Drupal

You can load a node if you know its Node ID using

$node = node_load($nid);

But if you know its title only, you can load the node as follows

$items = entity_load('node', FALSE, array(
  'type' => 'article',
  'title' => $title,

This will return an array of nodes that match that title, which you can then process.

Leave a Reply