---
url: /hooks/actions/wpce-after-document-from-post.md
description: >-
  Action fired after Document::from_post() creates a WPCE document instance from
  a WordPress post.
---

# `wpce_after_document_from_post`&#x20;

Fires after a [`Document`](https://bitbucket.org/ownbit/ownbit-wpce/src/dev/plugin/includes/WPCE/Document.php) instance has been created via `Document::from_post`.

## Parameters

1. `WPCE\Document $document`

   The [`Document`](https://bitbucket.org/ownbit/ownbit-wpce/src/dev/plugin/includes/WPCE/Document.php) instance that has been created.

2. `?WP_Post $post`

   The post the document was loaded for. May be `null` to indicate that the post should be detected from the environment (e.g. the loop's current post or a `$_GET['post']` parameter).

3. `bool $preview`

   Whether the document has been loaded as a preview.

## Example

```php
add_action('wpce_after_document_from_post', function (WPCE\Document $document, ?WP_Post $post, bool $preview) {
	// ...
}, 10, 3);
```

## Related

* [`wpce_before_document_load`](../filters/wpce-before-document-load)
* [`wpce_before_document_from_json`](../filters/wpce-before-document-from-json)
* [`wpce_before_document_from_post`](../filters/wpce-before-document-from-post)
* [`wpce_before_document_from_rest_request`](../filters/wpce-before-document-from-rest-request)
* [`wpce_before_document_from_save_request_body`](../filters/wpce-before-document-from-save-request-body)
