v3.4.0 — Themes, WP-CLI, SVG Uploads
A new Themes domain: give an AI agent full context on the active theme, manage its settings, and create a child theme so it can safely edit theme files.
Added
- WP-CLI tools (4 tools, free, disabled-by-default). Let a connected AI run
wpcommands:run-wp-cli(synchronous — returns stdout/stderr/exit code), plusdispatch-wp-cli/get-wp-cli-job/list-wp-cli-jobsfor background jobs (long migrations / bulk tasks run as a detached process you poll for status + output). Two execution modes: in-process viaWP_CLI::runcommand()when connected over the WP-CLI stdio transport (no shell), or aproc_openshell path (argv array — no shell interpolation) when an admin configures awpbase command (Connection tab, or theEMCP_TOOLS_WPCLI_COMMANDconstant) for HTTP/proxy connections. Guarded by a command blocklist (refuses eval, eval-file, shell, server, rawdb query/cli/import,config set,package install, and injection/retarget flags--exec/--require/--path/--ssh) with a quote-aware, Windows-path-safe tokenizer; all four requiremanage_options, ship disabled-by-default (command-execution surface), and runs are recorded to the change ledger. New classesEMCP_Tools_WPCLI_Validator/_Runner/_Jobs(includes/wpcli/) +EMCP_Tools_WPCLI_Abilities; a new WP-CLI category on the Tools tab. - Themes tab: theme integrations (two dispatcher tools each). A new Themes sub-tab on the Tools screen, following the ACF two-dispatcher pattern (one Read tool, one Write tool, each bundling internal operations). Two layers on a shared base so new frameworks are cheap to add:
- Active Theme (
theme-read/theme-write, works for any active theme).theme-read:get-theme-context(active/parent, detected framework,is_block_theme, template dir, theme supports, registered menu locations, whether a child theme exists) andget-mods(theme_mod values).theme-write:set-mods(write theme_mod values, structural keys like menu locations refused) andcreate-child-theme(scaffoldstyle.css+functions.phpand activate a child of the active parent, so the agent can then edit theme files via the Filesystem tools; requiresconfirm:true, idempotent, refuses grandchildren). - Astra (
astra-read/astra-write, registers only when Astra is the active theme). Genericget-settings({group? colors/typography/layout/header-footer,keys? }) andupdate-settings({values}) over a curatedastra-settingsallowlist, mirroring the WordPress Settings domain (typed metadata, non-allowlisted keys reported inskipped[]). - Spectra Blocks (
spectra-read/spectra-write, registers only when the Spectra plugin (Ultimate Addons for Gutenberg) is active). The blocks/builder counterpart to the Astra theme pack, a Spectra-aware discover -> inspect -> act layer that mirrors the Elementor widget catalog.spectra-read:list-blocks(compact catalog of the site's Spectra blocks, withcategory/searchfilters, sourced live from Spectra's registry so nothing is guessed) andget-block-schema(a block's key attributes: real attribute names + defaults read from Spectra's ownattributes.php, a highlighted subset by default or the first N capped,full:truefor the whole set, plus a ready-to-use example and a doc link).spectra-write:add-block(insert a Spectra block into a post at a position, with a generatedblock_id; Spectra applies its own defaults, and container blocks likebuttonsget their required inner-block template). Building pages then reuses the existing Gutenberg block tools against the returned post. - Astra and Spectra are grouped as one "Astra + Spectra" section on the Themes tab, since they are a theme + blocks combo. Each tool's toggle is enabled only when its component is installed and active (Astra tools require the Astra theme; Spectra tools require the Spectra plugin) and is greyed out + disabled otherwise, the same way Elementor tools are gated when Elementor is inactive, with a per-card hint on how to enable it.
Reads are enabled by default; the write dispatchers (theme-write/astra-write/spectra-write) ship disabled-by-default (opt in on the Tools tab). Building pages with a theme's blocks/patterns reuses the existing Gutenberg tools; this domain supplies the context. More framework packs (Kadence, GeneratePress) build on the same base.
- Active Theme (
- SVG Uploads module (free, opt-in). A self-contained, safe way to allow SVG uploads to the Media Library without a third-party plugin — aimed at sites without Elementor (Elementor already permits SVG for authorized users). When enabled on the Modules tab it (1) registers the
svgmime for users who canupload_files(or admins-only, a per-module toggle), (2) fixeswp_check_filetype_and_ext()so the real-content MIME check doesn't reject SVGs on the REST/sideload path (the piece most SVG plugins miss — sosideload-imageand the MCP media tools can import SVGs), and (3) sanitizes every uploaded SVG with the bundledenshrined/svg-sanitizelibrary (scripts, event handlers,javascript:URIs and external references stripped) — fail-closed: an SVG that can't be cleaned is rejected. Off by default given the security surface. New classesEMCP_Tools_SVG_Support_Module+EMCP_Tools_SVG_Sanitizer(includes/modules/svg-support/);enshrined/svg-sanitizeis bundled invendor/. get-block-schemanow surfaces Spectra's shared-helper attributes. A block'sattributes.php(whatget-block-schemareads) omits attributes registered via a shared helper — the container background image/video, border radius, and box shadow. The container schema now includes ashared_attributesmap (with the real attribute names, e.g.backgroundType:'image'+backgroundImage:{id,url}+ overlay,overlayType:'gradient'+gradientValue,containerBorder*Radius,boxShadow*) plus aschema_notesteering agents to these native attributes instead of acore/htmlworkaround.
Changed
search-imagesandsideload-imageare now core WordPress tools — they register on any site regardless of Elementor (they only need a stock-provider API key + the Media Library), matching the plugin's beyond-Elementor philosophy. Previously both were gated behind Elementor being active.add-stock-image(which adds an image widget to the page) remains Elementor-gated.