---
url: /hooks/actions/wpce-load-node.md
description: >-
  Action fired for each node while loading a document, useful for filtering or
  removing hidden nodes.
---

# `wpce_load_node`&#x20;

Fires for each Node in a WPCE Document when it's created.

## Parameters

1. `object $node`

   The node that is being loaded.

2. `WPCE\Document $document`

   The [`Document`](https://bitbucket.org/ownbit/ownbit-wpce/src/dev/plugin/includes/WPCE/Document.php) which contains the node.

## Example

```php
add_action('wpce_load_node', function (object $node, WPCE\Document $document) {
	// Remove all hidden nodes from the document
	if (($node->visisble ?? true) === false) {
		$document->remove($node);
	}
}, 10, 2);
```

## Related

* [`wpce_before_document_load`](./wpce-after-document-load)
* [`wpce_after_document_load`](./wpce-after-document-load)
* [`wpce_save_node`](./wpce-save-node)

***

:::info
This hook existed since WPCE , but was only used internally. Since , it's now a public hook with a slightly adjusted signature.
:::
