---
id: gk-block-mcp-templates-allow-edits
title: "Filter - gk/block-mcp/templates/allow-edits"
sidebar_label: "gk/block-mcp/templates/allow-edits"
tags:
  - "2.2.0"
---

# Filter: gk/block-mcp/templates/allow-edits

Control whether the AI assistant may edit theme templates and template parts.

Off by default. A template edit creates a database override — the theme file itself is never touched, and Appearance → Editor (or reset_template) reverts it. Return true to permit editing, false to forbid it regardless of the stored option.

## Parameters

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

## Example

```php
// Let the assistant edit templates only on the staging site.
add_filter( 'gk/block-mcp/templates/allow-edits', function ( $enabled ) {
    return wp_get_environment_type() === 'staging' ? true : $enabled;
} );
```

### Since

- 2.2.0

### Source

Defined in `wordpress-plugin/gk-block-mcp/includes/class-template-manager.php` at line 100

