Skip to content

Update texts related to templates to be suitable for custom post types #67697

@costasovo

Description

@costasovo

What problem does this address?

There are a couple of places where we refer to pages and posts when working with templates. A template can be used with a custom post type or multiple post types, so these messages can be confusing when a template is used, for example, for a product page or an email.

Examples

  • a dialog when a user double-clicks a template block in template-lock mode.

Image

  • a description in the Templates panel in the Save Changes sidebar

Image

This problem was also discussed in #67209

What is your proposed solution?

Option 1

We can avoid mentioning specific post types by making the messages more generic.
For example:
You’ve tried to select a block that is part of a template that may be used elsewhere on the site. Would you like to edit the template?
This change will affect other parts of your site that use this template.

Option 2

It is possible to associate a template with a custom post type or multiple post types via register_block_template and post_types. We could use this association, and in the messages, we could list labels of all post types associated with the template.

The post_types property is currently not available in the template data provided in the REST API. But there is a PR that exposes the property WordPress/wordpress-develop#7530. This PR seems to be a requirement for this second option to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions