Skip to content

Exported template parts aren't registered in theme.json templateParts #870

Open

Description

@iamtakashi

What happens

Saving template parts to theme files writes parts/*.html but never adds a templateParts entry to theme.json. add_templates_to_local() writes the files only:

https://github.com/WordPress/create-block-theme/blob/5524f195e8/includes/create-theme/theme-templates.php#L224-L303

A part created in the Site Editor, or a plugin part the user customized (for example WooCommerce's mini-cart or simple-product-add-to-cart-with-options), ends up in the theme with no title and no area. Once the plugin that registered it is inactive, it falls back to "Uncategorized" with its slug as the name.

Expected

Each exported part gets a templateParts entry with its name, title and area, unless one exists already.

Related

#653 asks for editing part names and categories. This issue is about registering new parts at all.

Drafted with AI assistance, verified by me against a theme exported with Create Block Theme and the source.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions