Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nerrad opened this issue Aug 31, 2022 · 1 comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Bug An existing feature does not function as intended

Comments

@nerrad
Copy link
Contributor

nerrad commented Aug 31, 2022

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

@nerrad nerrad added [Type] Bug An existing feature does not function as intended [Feature] Templates API Related to API powering block template functionality in the Site Editor labels Aug 31, 2022
@carolinan
Copy link
Contributor

How do you change the post_name value? (it is not the post title or the slug / url)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants