Skip to main content

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

NameTypeDescription
$enabledboolWhether editing is currently allowed by the stored option.

Example

// 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