---
url: /hooks/filters/wpce-enable-for-post.md
description: Filter whether WPCE is enabled for an individual post.
---

# `wpce_enable_for_post`&#x20;

Filters whether a certain post should editable by the WPCE.

This hook is only applied if the post's type generally is WPCE-enabled through [`wpce_enable_for_post_types`](./wpce-enable-for-post-types), so strictly speaking, it only allows to *disable* the WPCE for individual posts.

:::warning
Disabling the WPCE for individual posts also disables all the other post-related handling the WPCE does,
e.g. turning off the Gutenberg editor or rendering the post content in the frontend. It makes that particular post behave as if the WPCE was not installed at all.
:::

## Parameters

1. `bool $enabled`

   Whether the WPCE should be enabled for the post.

2. `WP_Post $post`

   The post to check.

## Example

```php
add_filter('wpce_enable_for_post', function (bool $enabled, WP_Post $post) {
	// Disable the WPCE for all posts published before 2024
	if ($post->post_date < '2024-01-01 00:00:00') return false;

	return $enabled;
}, 10, 2);
```

## Related

* [`wpce_enable_for_post_types`](./wpce-enable-for-post-types)
