Get the plugin
WP MCP/Integrations/Themes

Themes integration

GP Premium Elements AI agent tool reference

GP Premium keeps an Element as its own post type, the element kind (hook, header, layout or a block element's block type), the hook and priority, and its display, exclude and user conditions all in post meta, exactly as GeneratePress's own metabox writes them. WP MCP Pro adds six ops to the theme pair while GeneratePress is the active theme family: list-generatepress-layouts, get-generatepress-layout and the hook catalog on theme-read; create, update and set-display-rules on theme-write. Every refusal (an unknown type or hook, a hook on a type that takes none, a rule naming a post type, taxonomy or role the site lacks) is decided before any snapshot; create records the new element so rollback trashes it, and update and set-display-rules snapshot the element post with all its meta so rollback-operation restores it exactly. A hook element that executes PHP is read without its content and never written, and PHP execution is never switched on, 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.

theme-readtheme-write

In practice

How GP Premium Elements work goes with an agent.

GP Premium Elements are posts of the gp_elements type, and their kinds are not one list. There are classic hook, header and layout elements, plus block elements with a block type such as site-header, site-footer, sidebars, page-hero or hook. Placement is a hook and a priority, kept as a string. Where an element shows is two condition lists, display and exclude, plus user conditions, in the format GeneratePress's own metabox saves. WP MCP reads all of it with the hook catalog from GeneratePress's helper, and tells you which kinds it is willing to write.

List our GeneratePress elements and tell me which kinds are block elements.

Runs list-generatepress-layouts, filterable by type or status, where a block element shows as block/site-header, block/hook and so on. get-generatepress-layout reads one with its content and rules. Both are reads.

Which element types can be written, and which hooks are available?

Runs list-generatepress-hooks, which returns every type with its writable flag, the grouped hooks from GeneratePress's own list, and the display rule vocabulary. It is read only.

Create a hook element that adds a call to action below the post content.

Runs create-generatepress-layout with type hook, a hook from the catalog and a priority. It defaults to draft and is recorded as a creation, so rollback-operation trashes it.

Show element 212 on single posts but not on the Press category, and only to logged-out visitors.

Runs set-generatepress-layout-display-rules with display, exclude and users keys. Each key passed replaces that key, and a post type, taxonomy or role the site lacks is refused before the snapshot.

What your AI can do

Real GP Premium Elements operations, every write reversible.

  • List GP Premium Elements (hook, header, layout and block) and read one
  • Read the hook catalog an element can be placed on
  • Create an element and set its kind, hook and priority
  • Set an element's display, exclude and user conditions
  • Roll back a created or updated element exactly

Example prompts

Example GP Premium Elements prompts.

List our GeneratePress elements and where each one is hooked.

Create a hook element that adds a CTA below the content on posts.

Limit the header element to the homepage only.

Under the hood

The GP Premium Elements calls, under the hood.

wpmcp, gp-premium

theme-read({ operation: "list-generatepress-layouts" }), elements with kind, hook and conditions

theme-write({ operation: "set-generatepress-layout-display-rules", args: {…} }), Pro; opt-in; snapshotted, reversible

Safety and access

What can be undone on GP Premium Elements, and what costs what.

Recoverable on GP Premium Elements

  • update-generatepress-layout and set-generatepress-layout-display-rules snapshot the element post with all its meta, and rollback-operation restores it exactly.
  • create-generatepress-layout is recorded as a creation, and its rollback trashes the new element.
  • Refusals happen before a snapshot, so a refused call leaves nothing to undo.

GP Premium Elements limits and opt-ins

  • Writes are off until a site enables the wpmcp_enable_theme_write filter; reads need no switch.
  • A hook element that executes PHP is read without its content and never written, and PHP execution is never switched on.
  • Creation is limited to writable kinds: hook, block/hook, block/site-header, block/site-footer, both sidebars and block/page-hero. Classic header and layout elements and the template blocks are read only here.
  • Hook and priority apply only to hook kinds. Passing them for any other kind is refused with hook_not_allowed.

Free or Pro: The six GP Premium Element ops are Pro, on the theme-read and theme-write pair, and register only while GeneratePress is the active theme family. The free GeneratePress settings integration, which edits the generate_settings option, is a separate thing. Reads work on any licensed site; the three writes stay off until wpmcp_enable_theme_write is enabled, and every op needs edit_theme_options.

Part of WP MCP Pro

The GP Premium Elements integration is part of WP MCP Pro.

One Pro licence unlocks the GP Premium Elements 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

GP Premium Elements MCP: questions, answered.

Can the GP Premium Elements integration edit a PHP hook element?

No. A GP Premium hook element that executes PHP is read without its content and never written, and these ops never switch PHP execution on; code is out of scope on purpose.

Is the GP Premium Elements integration the same as the GeneratePress settings integration?

No. That integration edits the generate_settings option (colors, typography, layout). This Pro integration builds GP Premium's Elements and sets their hooks and display rules, for the active theme family only.

Which element kinds can it create, and which are read only?

Writable: classic hook elements and the block kinds hook, site-header, site-footer, right-sidebar, left-sidebar and page-hero. Read only: classic header and layout elements, and the template blocks (content, loop, post meta, post and archive navigation, search modal). create-generatepress-layout refuses those with layout_type_read_only and names the writable kinds.

What do GP Premium display rules look like?

An object with display and exclude lists of rule and object pairs, such as general:front_page or post:page, and a users list taking general:all, general:logged_in, general:logged_out or a role. Rules naming a post type, taxonomy or role the site lacks are refused. list-generatepress-hooks returns the full vocabulary.

Can an element be placed on any WordPress action?

A hook element can take any action name with custom_hook:true, except hooks that run before the page exists: init, wp, template_redirect, wp_enqueue_scripts and similar, which are refused as blocked_hook. Otherwise the hook must come from the catalog, or it is refused as unknown_hook with a pointer to list-generatepress-hooks.

What if the Elements module is switched off?

GP Premium can be active with its Elements module off, in which case the ops answer module_disabled and say to activate the Elements module under Appearance, GeneratePress. If GP Premium is missing or inactive, they answer plugin_missing or plugin_inactive with a link to the plugins screen.

Point your AI at GP Premium Elements.