Make WordPress Core

Opened 15 months ago

Last modified 13 months ago

#56652 new defect (bug)

New Template Part block content isn't saved when saving a post draft in 6.1

Reported by: ashleyleia's profile ashleyleia Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.1
Component: Editor Keywords: close
Focuses: Cc:

Description

When adding a new "Template Part" block to a post in the block editor, any content that's added to that block isn't saved when the user saves a draft of the post; it only saves if a user clicks Publish. After saving a draft and refreshing the screen, the content is replaced with an empty Template Part block that can't be edited.

Steps to reproduce:
1) Create a new post.
2) Add a "Template Part" block.
3) Select "Start blank", and give the template a name.
4) Within the template block, create a paragraph block and add some text.
5) Save the post draft.
6) Refresh the page. An alert will pop up confirming you want to leave the page with unsaved changes. After the page refreshes, there's an un-editable empty template block as in the attached screenshot.

I'm using 6.1 Beta 1 with no active plugins on MacOS in both Chrome and Safari. Tested with Twenty Twenty-Three, Twenty-Two, and Twenty-One.

Attachments (1)

empty template part.png (96.5 KB) - added by ashleyleia 15 months ago.

Download all attachments as: .zip

Change History (4)

#1 @poena
14 months ago

Hi!

The template part is not intended to be available in the block editor, this issue will be solved with the fix for 44397

#2 @poena
13 months ago

  • Keywords close added

I re-tested in WordPress 6.1.1 and Twenty Twenty-Three, and confirmed that the template part is not available in the inserter in the block editor.

Next, I opened the code editor mode in the block editor and copy pasted the following template part:

<!-- wp:template-part {"slug":"header","theme":"twentytwentythree","tagName":"header"} /-->
  • The header shows correctly in the block editor
  • Saving the draft works without errors
  • The header shows correctly in the preview of the draft on the front
  • Refreshing the draft post works without errors
  • Publishing works without errors
  • The header shows correctly on the front after it has been published

Editing:

  • Editing existing blocks inside the template part works without errors
  • Adding new blocks inside the template part works without errors

Next, I switched to Twenty Twenty-One (classic theme).
The previously saved post with the header that was copied from Twenty Twenty-Three displays correctly in the block editor.

On the front, there is a message with the text: "Template part has been deleted or is unavailable: header"

Editing the blocks inside the template part works without errors, and saving works without errors.
After saving changes, the front still displays "Template part has been deleted or is unavailable: header"


I am not sure if this behavior on theme switch is the expected behavior, but if it is a bug, it is a separate issue.

I am not able to reproduce the reported issue and I suggest that we close this ticket.

#3 @poena
13 months ago

  • Version set to 6.1
Note: See TracTickets for help on using tickets.