Skip to content

P2: Custom templates are hardcoded to the ucsc-2022 theme term #109

Description

@Herm71

Roadmap item 18 (P2).

Problem

Template\Template::NAMESPACE is the literal ucsc-2022. Injected block templates are created as wp_template posts tagged with that wp_theme term, which binds them to one specific theme by slug. Renaming the theme directory, forking it, or switching themes silently orphans every plugin-provided template — no error, the templates just stop resolving, and the stale posts stay in the database.

Options

  1. Derive the namespace from get_stylesheet() at runtime, so templates follow the active theme.
  2. Keep it explicit but make it filterable / a constant a site can override.
  3. Detect a mismatch and surface an admin notice rather than failing silently.

Option 1 is the smallest correct change; option 3 is worth adding regardless, since the current failure mode is invisible.

Whichever is chosen, decide what happens to already-created template posts under the old term — a migration or a cleanup path is needed, and it overlaps with the uninstall work in #108.

Acceptance

  • Theme rename or switch no longer silently orphans plugin templates
  • Existing ucsc-2022-tagged templates are migrated or cleaned up
  • Mismatch is visible to an admin rather than silent

Location: src/Template/Template.php:14

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Performance & lifecycle

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions