Appearance
Read and Update Block Theme Templates with AI
Use Easy MCP AI to find and update templates in your active block theme. Read a template before changing it, because an update replaces its entire content.
In this article
Before you start
Your site must have an active block theme, and the WordPress user connected to your AI client must have the edit_theme_options capability. A capability is a WordPress permission; this one allows the user to edit theme options and templates.
If wp_update_template is disabled, an administrator can enable it:
- In WordPress, go to Easy MCP AI > Settings.
- Open Advanced and find Disabled tools.
- Clear the checkbox next to
wp_update_template, then click Save changes.
Read and update a template
- Ask your AI client to call
wp_list_templatesand find the template you want to change. The result includes the template'sid; use that value exactly as returned. - Ask it to call
wp_get_templatewith thatidastemplate_id. Keep the matchingtype:templateis the default for regular templates, andtemplate_partis for headers, footers, and other reusable areas. - Review the current content returned by
wp_get_templatebefore making a change. Then ask your AI client to callwp_update_templatewith the sametemplate_id, the matchingtype, and the complete content you want the template to have.
The content sent to wp_update_template replaces the template's entire content; it does not change just the part you edited. Include everything that should remain in the template, not only the new or changed section.
Use template IDs exactly
A template ID has this format:
text
theme-slug//template-slugThe theme part can include dots and at most one parent folder. For example, my.theme//index and agency/acme//index are valid formats. Each theme folder can contain only ASCII letters, numbers, dots, hyphens, and underscores, and cannot start with a dot. The final template slug can contain only ASCII letters, numbers, hyphens, and underscores.
Percent-encoded slugs are rejected; do not decode or rewrite them. IDs with deeper theme paths, such as a/b/c//index, are also rejected. Do not try to repair an invalid ID: changing it can make it identify a different template.