Themes integration
Astra Pro Custom Layouts MCP
Astra Pro keeps a Custom Layout as its own post type, the layout kind, the hooks it is placed on and its display and exclusion rules all in post meta, written the way Astra's own metabox writes them. WP MCP Pro adds six ops to the theme pair while Astra is the active theme family: list-astra-layouts, get-astra-layout and the hook catalog on theme-read; create, update and set-display-rules on theme-write. Every refusal (an unknown hook, a rule naming a post type, taxonomy or role the site lacks) is decided before any snapshot; create records the new layout so rollback trashes it, and update and set-display-rules snapshot the layout post with all its meta so rollback-operation restores it exactly. A layout written in Astra's code editor keeps its PHP in meta these ops never read or write, so code stays out of scope. Writes are off until a site opts in with the theme write switch, and every op takes edit_theme_options.
In practice
How Astra Pro Custom Layouts work goes with an agent.
Astra Pro keeps every Custom Layout as a post of the astra-advanced-hook type, and the interesting parts live in post meta: the layout kind, the hook it fires on, a priority, and separate location, exclusion and user rules. Those rules are stored in a particular nested shape that Astra's own metabox writes. WP MCP writes the same shape, and checks that every post type, taxonomy and role named in a rule exists on the site. An agent can therefore place a banner or header precisely without the rule silently matching nothing.
List our Astra layouts and where each one is placed.
Runs list-astra-layouts, which returns id, title, status, kind, hook, priority and the location, exclusion and user rules for each. Add type or status to filter. Read only.
Which hooks can I attach a banner to, and what format do display rules use?
Runs list-astra-hooks, which returns the layout types, which of them are writable, Astra's hook groups, and the rule vocabulary including the site's own post types and taxonomies.
Create a hooks layout with a sale notice, placed before the header, saved as a draft.
Runs create-astra-layout with type hooks and a hook from the catalog. Status defaults to draft. It is recorded as a creation, so rollback-operation moves it to the trash.
Show the sale notice on the Shop and product pages, but not to logged-in users.
Runs set-astra-layout-display-rules with location rules for the shop and product post type, and a users rule. Unknown post types or roles are refused before any snapshot, and the layout post is snapshotted with all its meta.
What your AI can do
Real Astra Pro Custom Layouts operations, every write reversible.
- List Astra Pro Custom Layouts and read one
- Read the hook catalog a layout can be placed on
- Create a layout and set its kind and hook
- Set a layout's display and exclusion rules, validated first
- Roll back a created or updated layout exactly
Example prompts
Example Astra Pro Custom Layouts prompts.
List our Astra custom layouts and where each one is hooked.
Create a custom layout that adds a notice bar above the header site-wide.
Limit the sale banner layout to the Shop and product pages.
Under the hood
The Astra Pro Custom Layouts calls, under the hood.
theme-read({ operation: "list-astra-layouts" }), layouts with kind, hook and rules
theme-write({ operation: "set-astra-layout-display-rules", args: {…} }), Pro; opt-in; snapshotted, reversible
Safety and access
What can be undone on Astra Pro Custom Layouts, and what costs what.
Recoverable on Astra Pro Custom Layouts
- update-astra-layout and set-astra-layout-display-rules snapshot the layout post together with all of its meta.
- rollback-operation restores the content, hook, priority and every rule exactly.
- A layout made by create-astra-layout is recorded as a creation, and rolling it back moves it to the trash.
Astra Pro Custom Layouts limits and opt-ins
- Writes are off until the site turns on the wpmcp_enable_theme_write filter, and every operation needs the edit_theme_options capability.
- Only the header, footer, 404 page and hooks layout types can be created. The content and template types are listed but not writable.
- A layout in Astra's code editor is refused: its PHP is never read or written, and these operations never turn PHP execution on.
- A hook that runs before the page exists, such as init or plugins_loaded, is refused as a custom hook.
Free or Pro: This is a Pro integration. All six operations are Pro, the three reads and the three writes. They need Astra Pro active with its Custom Layouts module on. Otherwise the answer is plugin_missing, plugin_inactive or module_disabled, with a pointer to where to switch it on. The Astra theme color pack is free, and a site without Astra Pro still has that.
Part of WP MCP Pro
The Astra Pro Custom Layouts integration is part of WP MCP Pro.
One Pro licence unlocks the Astra Pro Custom Layouts tools and every other Pro integration on this site: Elementor deep editing, the other page builders, the forms adapter pack and more, 133 Pro tools in all. The free plugin still covers the rest of WordPress and the full snapshot and undo engine, so you can try the safety model before you buy.
Frequently asked
Astra Pro Custom Layouts MCP: questions, answered.
Can the Astra Pro Custom Layouts integration edit a code-editor layout?
No. An Astra code-editor layout keeps its PHP in meta these ops never read or write; code is out of scope on purpose. The ops build and place header, footer, 404 page and hook layouts and set their display rules.
Is the Astra Pro Custom Layouts integration the same as the Astra theme settings integration?
No. That free integration edits the Astra theme's own colors and widths. This Pro integration builds Astra Pro's Custom Layouts, elements and hooks, for the active theme family only.
What happens if the Custom Layouts module is off?
Every operation answers module_disabled and says where to turn the module on, under Astra, Dashboard, Modules. If the Astra Pro plugin is not installed or not active the error is plugin_missing or plugin_inactive instead. Nothing is read or written in either case.
How are display rules written?
As location, exclusion and users keys. Location and exclusion each take a rule list and a specific list, for example a post type with all, or post-<id> for one page. Users take all, logged-in, logged-out or a role. Keys you leave out are kept, and keys you pass replace the old value.
Does a 404 layout need display rules?
No. Astra forces a 404 layout onto the 404 page, so when the type is 404-page the location rule is set to the special 404 target automatically. You can still use the exclusion and user rules to narrow when it shows.
Related integrations
More integrations for the same agent.
MCP for Astra
FreeThemes, 2 tools.
MCP for Kadence Theme
FreeThemes, 2 tools.
MCP for GeneratePress
ProThemes, 2 tools.
MCP for Blocksy
ProThemes, 4 tools.
MCP for Kadence Pro Elements
ProThemes, 2 tools.
MCP for GP Premium Elements
ProThemes, 2 tools.
Browse the full Integrations hub, or read more on the WordPress MCP plugin.