Skip to content

Custom Post (or post type) block templates are orphaned when post slug changes. #43749

@nerrad

Description

@nerrad

Description

Block templates are connected to specific URL paths and are not updated if the original post's post_name is updated. We might want to consider linking to the short URL (canonical) as a reference instead.

Step-by-step reproduction instructions

  1. Create a post "Test Post A" and publish. Observe that with permalinks enabled, the post_name is test-post-a.
  2. Create a custom block template for the previous post and add some additional blocks to the template to help verify this custom template is loaded on the front end. After saving the template, view the post on the frontend and it should be using the custom template.
  3. Edit the "Test Post A" post and change the post_name value to something different.
  4. View the post on the frontend and you'll see that it is no longer using the custom template that was created.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress: 6.0.2
  • Gutenberg: 13.9.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Templates APIRelated to API powering block template functionality in the Site Editor[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions