Inicio - Documentación - POM AI - 20 MCP - POM Theme template tools - `pom_theme_delete_html_template`: delete an HTML template

pom_theme_delete_html_template: delete an HTML template

Removes a template. Marked destructive; there is no trash and no revision history.

Arguments

Argument Required Meaning
template_type Yes archive, single or feed
repeater_identifier Yes The template to remove
dry_run No Report without deleting

Permissions

Allow POM Theme writes open, plus manage_options.

Check the assignments first

This is the step that separates a tidy-up from an outage. A template that renders a live archive or post type is one that pages depend on, and nothing in this tool warns you.

Read the template assignments, then tell me whether this template is in use anywhere.

Deleting an assigned template leaves the assignment pointing at nothing. The affected pages fall back to whatever the theme does with a missing template — which is not a state you want to discover from a visitor.

Reassign first, delete second.

Nothing cleans up the assignment

Removing the template does not clear the setting that pointed at it. The stale reference stays until someone overwrites it with pom_theme_assign_template.

So after deleting an assigned template, the site has an assignment naming a template that no longer exists — and re-reading the assignments will show that identifier as though it were valid.

A wrong identifier reports success

Like the CSS snippet deletion, this filters the list and reports deleted as whether the count changed.

An identifier that matches nothing returns deleted: false — not an error. And because the lookup is scoped to template_type, a correct identifier under the wrong type produces exactly the same quiet non-result.

Read the value. A call that "succeeded" may have done nothing.

The dry run counts, and catches the type mismatch

It returns before_count and after_count for that template type. Equal counts mean the identifier matched nothing in that type — which is the case worth catching.

It does not tell you which template, or its markup, or whether it is assigned. Confirm those from the listing and the assignments.

Read and keep the markup

Templates have no revisions. The output of pom_theme_get_html_template is the only copy.

Show me the full markup of that template. I want to keep it before you delete it.

Save it outside the conversation. A template represents real design work, and rewriting one from memory is not the same as restoring it.

Unassigning is the reversible alternative

If the goal is to stop a template rendering, point the target at a different template or a built-in layout. The template stays, and switching back is one call.

Delete only templates that are genuinely obsolete — and confirm they are unassigned first, in which case deleting them changes nothing visible at all.

Attached assets survive

The CSS snippets and scripts a template referenced are not deleted with it. They remain, unreferenced, and stay in the compiled stylesheet.

That is safe but untidy: deleting several templates over time leaves orphaned snippets. Audit them separately with pom_theme_get_custom_css.

After deleting

  1. Check deleted is true.
  2. List the templates of that type and confirm the right one went.
  3. Read the assignments and confirm nothing points at the removed identifier.
  4. Load affected page types.
  5. Purge the cache.

Common problems

Symptom Cause
The write is refused POM Theme write gate closed
pom_ai_mcp_forbidden Missing manage_options
pom_ai_mcp_invalid_template_type Not one of the three types
deleted is false The identifier matched nothing in that type
The dry run counts are equal Same cause
Pages render wrongly The template was assigned
An assignment names a missing template Assignments are not cleaned up
It cannot be restored Correct; no trash, no revisions

Related