Operations integration
Code Snippets MCP
Code Snippets keeps a site's snippets in its own table and runs every active PHP snippet on each request. WP MCP goes through the plugin's own API, so its caches, hooks and flat files follow, and only the site's snippets are touched, never network snippets. Reads list snippets (id, name, type, scope, status, no code) and read one with its code and, for PHP, a static check report. The safety posture is the plugin's own: create-snippet stores a PHP snippet inactive and refuses code that fails the static validator before anything is written; update-snippet re-checks new code and leaves the snippet inactive, and refuses an active snippet outright, since Code Snippets re-runs an active snippet's code whenever it is saved, so it is switched off first; deactivate-snippet is never gated, so an active snippet can always be switched off. Only PHP snippets are written; HTML, CSS and JS snippets are listed and read only. Every write is snapshotted as a row image first, so rollback-operation restores the row exactly, except that an undo never leaves a snippet active. Create and update never save a snippet active; the Pro operation code-snippets-activate-snippet can, but only when PHP execution is enabled with WPMCP_ALLOW_PHP_EXEC, which is off by default.
In practice
How Code Snippets work goes with an agent.
Code Snippets stores each snippet as a row in its own table and runs every active PHP snippet on every request, which is why a careless write is dangerous here. WP MCP works through the plugin's own API and builds the safety in at that point: new and edited PHP is checked first and stored inactive, and an active snippet is never edited in place. Reads return the snippet list without code, or one snippet with its code and a static check report, so an agent can review before it changes anything.
Which snippets are active on the front end?
Runs code-snippets-list-snippets with scope front-end and status active. It returns id, name, type, scope, status, tags and priority, up to 100 per page, with no code. Trashed snippets are hidden unless you filter for them.
Show me snippet 14 and tell me whether its code passes the check.
Runs code-snippets-get-snippet, which returns the snippet with its code and, for PHP, a validation report with syntax_valid and safe. The check is advisory, a speed-bump and not a security boundary.
Add a snippet that hides the admin bar for non-admins, but leave it switched off.
Runs code-snippets-create-snippet. The code must pass the static check and a size limit, and the snippet is saved inactive, with scope global and priority 10 unless you say otherwise. It is snapshotted, and rollback deletes it.
Switch off snippet 9 right now, it is throwing notices.
Runs code-snippets-deactivate-snippet, which is never gated, so an active snippet can always be turned off. The row is snapshotted first, and undoing a deactivation leaves the snippet off.
What your AI can do
Real Code Snippets operations, every write reversible.
- List snippets and read one with its code and a static check report
- Create a PHP snippet, stored inactive and validated first
- Update a PHP snippet's code, which leaves it inactive
- Deactivate an active snippet
- Roll back any write exactly, restoring the snippet's previous state
Example prompts
Example Code Snippets prompts.
List the active PHP snippets on this site.
Add a snippet that disables the admin bar for non-admins, but leave it switched off.
Deactivate the snippet that is throwing a notice.
Under the hood
The Code Snippets calls, under the hood.
plugin-data-read({ integration: "code-snippets", operation: "list-snippets", args: { scope: "global", status: "active" } }), no code in the list
plugin-data-write({ integration: "code-snippets", operation: "create-snippet", args: {…} }), stored inactive, validated, snapshotted
Safety and access
What can be undone on Code Snippets, and what costs what.
Recoverable on Code Snippets
- Every write snapshots the snippet's whole table row, plus its entry in Code Snippets' recently-active list.
- rollback-operation restores that row exactly. Undoing a create deletes the snippet through Code Snippets' own delete, so its cache and files go with it.
- An undo never leaves a snippet active. Undoing an activation switches it off.
Code Snippets limits and opt-ins
- create-snippet and update-snippet never activate anything. update-snippet refuses an active snippet, because Code Snippets re-runs active code on save, so it must be deactivated first.
- Activation exists only as a separate Pro operation, code-snippets-activate-snippet. It is refused unless PHP execution is enabled (WPMCP_ALLOW_PHP_EXEC or the wpmcp_allow_php_exec filter, default off) and the environment allows it. Production is refused by default. Every attempt is audited.
- Only PHP snippets are written. HTML, CSS and JS snippets are listed and read only, and locked snippets are refused.
- Network-wide snippets are never touched, only the site's own.
- Every operation needs manage_options plus Code Snippets' own permission to manage snippets.
Free or Pro: Listing, reading, creating, editing and deactivating snippets are free, and none of them can make a new piece of PHP run. Pro adds a single operation, code-snippets-activate-snippet, and it is behind a second switch as well: PHP execution must be turned on for the site first, which is off by default and meant for development or staging. A free-tier site therefore gets snippet management without any path to executing agent-written code.
In the free plugin
The Code Snippets integration is in the free plugin.
The core Code Snippets tools ship in the free, GPL plugin with the full snapshot and undo engine, and no trial clock. Pro adds 133 more tools, including Elementor deep editing, the other page builders, the forms adapter pack and, for some integrations, extra operations. The pricing page lists what each tier includes.
Frequently asked
Code Snippets MCP: questions, answered.
Will an agent run PHP on my site?
Not by default. Create and update always store a PHP snippet inactive. A separate Pro operation, code-snippets-activate-snippet, can switch one on, but it is refused unless PHP execution is enabled with WPMCP_ALLOW_PHP_EXEC, which is off by default, and the environment allows it.
Is the static check a security boundary?
No, it is an advisory speed-bump that catches obvious mistakes before a write. The real safety is that snippets are stored inactive and that every write is snapshotted and reversible.
Can an agent turn a snippet on?
Only through the Pro activation operation, and only once PHP execution is enabled for the site, on an environment that permits it. The stored code is re-checked at call time and again during the write, and a mismatch switches it straight back off.
What does the validation report contain?
For PHP snippets, get-snippet returns a report with syntax_valid and safe results. A write needs both to pass. It catches obvious mistakes, but it can be evaded by a determined caller, so it is not the safety boundary.
Why must I deactivate a snippet before editing it?
Code Snippets re-runs an active snippet's code whenever it is saved. To keep an edit from executing as a side effect, update-snippet refuses active snippets. Deactivate, edit, then activate yourself, or through the gated Pro operation.
Does the Code Snippets integration handle snippets in the trash?
They are hidden from the default list and shown with status trashed. Deactivate and activate refuse a trashed snippet with snippet_trashed, so a deleted snippet cannot be switched back on by accident.
Related integrations
More integrations for the same agent.
MCP for Perfmatters
ProOperations, 2 tools.
MCP for Meta Box
FreeCustom fields, 5 tools.
MCP for ACF & ACF Pro
FreeCustom fields, 5 tools.
MCP for UpdraftPlus
FreeOperations, 2 tools.
MCP for Duplicator
FreeOperations, 1 tools.
MCP for Solid Security
FreeOperations, 1 tools.
Browse the full Integrations hub, or read more on the WordPress MCP plugin.