---
url: /hooks/actions/wpce-after-save.md
description: >-
  Action fired after a WPCE document is saved, receiving the post and document
  and also running for revisions and previews.
---

# `wpce_after_save`&#x20;

Fires after saving the WPCE document of a post.

:::info
This hook also triggers for saving revisions. Check the `$post->post_type` to make sure you're only handling the post types you're interested in.
:::

## Parameters

1. `WP_Post $post`

   The post the saved document is attached to.

2. `WPCE\Document $document`

   The [`Document`](https://bitbucket.org/ownbit/ownbit-wpce/src/dev/plugin/includes/WPCE/Document.php) being saved.

3. `bool $preview`

   Whether the document is being saved as a preview.

## Example

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

## Related

* [`wpce_before_save`](./wpce-before-save)
* [`wpce_save_node`](./wpce-save-node)
