4.6.x node.php hook_load($node)
4.7.x node.php hook_load($node)
5.x node.php hook_load($node)
6.x node.php hook_load($node)
7.x node.api.php hook_load($nodes)

Load node-type-specific information.

This is a hook used by node modules. It is called to allow the module a chance to load extra information that it stores about a node, or possibly replace already loaded information - which can be dangerous.


$node: The node being loaded. At call time, node.module has already loaded the basic information about the node, such as its node ID (nid), title, and body.

Return value

An object containing properties of the node being loaded. This will be merged with the passed-in $node to result in an object containing a set of properties resulting from adding the extra properties to the passed-in ones, and overwriting the passed-in ones with the extra properties if they have the same name as passed-in properties.

For a detailed usage example, see node_example.module.

Related topics

21 functions implement hook_load()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

actions_load in includes/actions.inc
Retrieve a single action from the database.
aggregator_category_load in modules/aggregator/aggregator.module
Load an aggregator category.
aggregator_feed_items_load in modules/aggregator/aggregator.pages.inc
Load feed items by passing a SQL query.
aggregator_feed_load in modules/aggregator/aggregator.module
Load an aggregator feed.
book_link_load in modules/book/book.module
Like menu_link_load(), but adds additional data from the {book} table.

... See full list

1 invocation of hook_load()
user_load in modules/user/user.module
Fetch a user object.


developer/hooks/node.php, line 320
These hooks are defined by node modules, modules that define a new kind of node.


function hook_load($node) {
  $additions = db_fetch_object(db_query('SELECT * FROM {mytable} WHERE vid = %d', $node->vid));
  return $additions;


beefzilla’s picture

I experienced a problem with calling this function from a non-hook because I expected the returned object to contain all the properties of the node, and whatever else gets loaded in hook_load. Instead, as the API is worded, this function should only return new properties specific to your content module's node type. You may have to merge the $node and the object containing all your new properties returned by hook_load, to work with a complete node object.

byoms23’s picture

@beefzilla I don't know if this still will work for you, but here it is a simple solution:

function hook_load($node) {
$additions = db_fetch_object(db_query('SELECT * FROM {mytable} AS mt INNER JOIN {node} AS n ON mt.nid = n.nid WHERE vid = %d', $node->vid));
return $additions;

Dewi Morgan’s picture

The code for this function assumes that {mytable} is indexed by $node->vid, when the code for hook_insert(), hook_update(), and hook_delete() assumes it's indexed by $node->nid.

In case anyone was wondering about this, it seems to be just a typo/inconsistency, and could just as well be $node->nid here, too.

There's nothing unusual about this function that makes it any different from the others: $node->nid is still set, so if you've made a new table for your content type, you can still use it in just the same way as the other hook functions.

The code as they have it might cause issues if you *do* have multiple lines per nid, so that's probably what they were trying to call attention to by using vid rather than nid here.