Skip to content

Add a read ability for block templates and whether the active theme supports them #1303

Description

@whyisjake

An agent that wants to change how a page looks needs to know first:

  • whether the active theme is a block theme;
  • which templates exist, which ones the theme ships as files, and which have been edited.

Today the only way to know is to try. The AI Workspace's template proposals (#1298) check wp_is_block_theme() and get_block_template() themselves at the moment they propose. A read-only ability would let any consumer ask first.

Proposed: core/templates-query returning { block_theme: bool, theme: name, templates: [{ slug, title, source: theme|custom|plugin, has_theme_file }] }, read-only and needing edit_theme_options. Modeled on how the plugin registers core/content-query.

AI assistance: Yes. Tool(s): Claude Code (Claude Opus 5.5). Used for: drafting this issue from the work in the linked PRs, which I checked.

I've reviewed the changes, understand them and can explain them under review.

Activity

  1. yaman-694 commented on Nov 6, 2026

    @yaman-694

    Hi @whyisjake, thanks for writing this up so clearly, and for splitting the missing abilities out of the AI Workspace work. It made the gap easy to understand.

    I'd like to work on this one.

    My plan is to follow how core/content-query is registered and add core/templates-query with the shape you proposed:

    • block_theme from wp_is_block_theme(), plus the active theme's name;
    • templates from get_block_templates(), each with slug, title, source and has_theme_file;
    • read-only, gated on edit_theme_options, with tests for block vs. classic themes, theme vs. user-edited templates, and a user without the capability.

    A few questions before I start:

    1. Should it cover template parts (wp_template_part) too, or only wp_template for now?
    2. Should it sit behind the Custom Abilities experiment like the other core/* abilities, and be marked public?
    3. Is core/templates-query the name you'd like to keep, or should it match something planned for core?

    Happy to adjust to whatever fits best with #1298. I'll open a draft PR once I have something to look at.

  2. moved this from Triage to In progress in WordPress AI Roadmapon Nov 6, 2026
  3. dkotter commented on Nov 6, 2026

    @dkotter
    Contributor

    I don't feel strongly on how valuable this ability will actually be but the main thing we will need to change here is we should stop using core/ as our prefix.

    For reference, that prefix is saved for abilities that we think will end up in WordPress Core itself. Going forward, those abilities will be handled in a separate package instead of directly here (see #1289).

    I don't know if this ability warrants a Core version so I'd suggest we go with ai/ as the prefix

  4. yaman-694 commented on Nov 8, 2026

    @yaman-694

    Thanks @dkotter, that makes sense. I'll switch the prefix to ai/ in #1309 (as ai/templates-query, unless you'd prefer the ai/get-* style used by ai/get-post-details), and keep it behind the Custom Abilities experiment.

    On the value, the concrete case is #1298: the workspace can now propose a block template, but it refuses on a classic theme and refuses to replace a template someone has already edited. Today the model only learns that after it proposes. With this ability it can check first, which theme is active, whether it's a block theme, and which templates are still the theme's own (source: theme) versus edited (source: custom), and propose something that can actually be applied.

    It's also useful outside the workspace. Over MCP, an agent asked "what templates does my site have?" can now answer, including which ones were customized in the Site Editor, which it can't find out any other way.

    It's read-only, makes no AI calls, and is small. If it doesn't feel worth carrying yet, I'm happy to close it. Just let me know.

  5. nikolas4175-godaddy commented on Nov 10, 2026

    @nikolas4175-godaddy

    Throwing my two cents in: This feels like it should eventually be solvable through core abilities since it concerns reading site data that should share a common structure across all WP sites. Specifically, I think Jake's original description lays out two ability-shaped pieces:

    • Get metadata about the current theme
    • Query registered templates

    As we move forward with the #1289 proposal, I'd expect those to land as experimental abilities in that package first, with an eye toward developing them for GB or core inclusion later.

  6. jeffpaul commented on Nov 13, 2026

    @jeffpaul
    Member

    Flagging to @nikmclaughlin that this will be needed in the abilities package to benefit the AI Workspace effort.

  7. added this to the 1.7.0 milestone on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions