---
id: gk-block-mcp-post-allow-trash
title: "Filter - gk/block-mcp/post/allow-trash"
sidebar_label: "gk/block-mcp/post/allow-trash"
tags:
  - "2.0.0"
---

# Filter: gk/block-mcp/post/allow-trash

Control whether the AI assistant may move posts to the trash.

Trashing is off by default and the agent has no delete capability, but moving a post to trash only needs edit access — so this is the real gate. There's a checkbox for it in Settings; use the filter when you'd rather decide in code, for example allowing the assistant to tidy up only its own draft posts while keeping everything else untouchable. Return true to permit trashing, false to forbid it.

## Parameters

| Name | Type | Description |
|------|------|-------------|
| $enabled | `bool` | Whether trashing is currently allowed by the stored option. |

## Example

// Let the assistant trash posts only on the staging site.

```php
add_filter( 'gk/block-mcp/post/allow-trash', function ( $enabled ) {
    return wp_get_environment_type() === 'staging' ? true : $enabled;
} );
```

### Since

- [2.0.0](../../since/2-0-0/)

### Source

Defined in `wordpress-plugin/gk-block-api/includes/class-post-manager.php` at line 82

