I've found node_load_multiple() which allows me to get all the nodes, but I need to specify some parameters, e.g. the type of node that I'd like to fetch.

I'd like to get all the nodes in the system without the criteria. How can I do that?

3 Answers 3


The easiest way would be to use entity_load()

$nodes = entity_load('node');

If you don't provide the second argument ($ids) it will load up all entities of the given type:

$ids: An array of entity IDs, or FALSE to load all entities.

Just for the sake of completeness node_load_multiple() doesn't require the $conditions parameter so you could also grab all of the node ids from the database

$nids = db_query('SELECT nid FROM {node}')->fetchCol();

And then use $nids to load the nodes:

$nodes = node_load_multiple($nids);
  • MrFluff asked how to load all nodes of specific type, not all nodes at all Nov 1, 2012 at 15:59
  • 1
    @Eugene admittedly it's a bit confusing but the question was actually I'd like to get all the notes in the system without the criteria. How can I do that? so he's looking for all nodes, not just those of a specific type
    – Clive
    Nov 1, 2012 at 18:35
  • As i understand "Notes" are not "Nodes" - this is custom content type. Nov 6, 2012 at 12:21
  • 1
    @EugeneFidelin I think we can safely assume he meant 'nodes', as the answer has been accepted :)
    – Clive
    Nov 6, 2012 at 13:00

Just use node_load_multiple(FALSE), and you will get all the nodes present in the site.

Keep in mind that it returns all the nodes, and this would be a problem when there are many nodes: The function takes time to be executed, and each node uses memory to be stored. With enough nodes, you would exhaust all the available memory.

Using the EntityFieldQuery class, you can limit the number of returned nodes.

$query = new EntityFieldQuery();

$query->entityCondition('entity_type', 'node')
  ->propertyCondition('status', 1)
  // It returns the first 10 nodes.
  // Use range(10, 10) to get the next 10 nodes.
  ->range(0, 10);  

$result = $query->execute();

if (isset($result['node'])) {
  $nodes = entity_load('node', array_keys($result['node']));

I added propertyCondition('status', 1) because you are normally interested on published nodes; if you want to get all the nodes, remove that line.

Notice that the $conditions parameter for node_load_multiple() is not anymore used in Drupal 8. If you need to get some nodes basing on some conditions, you should use the EntityFieldQuery class.



Here is another way to find all node ids in your website.

$nids = array_values(\Drupal::entityQuery('node')->execute());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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