Block meta related to the Notes is included in new post
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 53
- Forks
- 38
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
WordPress 6.9 introduces a new feature, Notes, which allows users to leave block-level notes when editing content.
Under the hood, notes are just WP_Comments with the comment_type of note. The post association is made through the comment_post_ID field in each WP_Comment object/database, and a note is associated with a block through block-level metadata.
<!-- wp:paragraph {"metadata":{"noteId":3}} -->
<p>This is some text about the walk I took at the reservoir. </p>
<!-- /wp:paragraph -->
After cloning a post, the notes are not shown, but the metadata remains. WordPress Core does not currently strip out noteId metadata, and it prevents the user from adding new notes for the same block. I've created https://github.com/WordPress/gutenberg/issues/73017 for this.
If the code is changed to always remove old, invalid metadata related to notes, then this bug can be closed. If the broken behavior is fixed and the metadata is left, removing it when a clone occurs could clean the block markup for the new post.
- I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened
To Reproduce
Step-by-step reproduction instructions
- Create a new post using WordPress 6.9 (currently in beta3)
- Add a few blocks and Notes on the blocks.
- Clone the post.
- Open the new post in the editor and use the Code Editor.
Expected results
- The post does not have block-level metadata related to notes.
Actual results
- The block-level metadata remains.
Screenshots, screen recording, code snippet
If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.
Technical info
- If relevant, which editor is affected (or editors):
- Block Editor
- Gutenberg Editor
- Classic Editor
- Other:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the post-cloning flow and inspecting the cloned block markup in the Code Editor, focusing on noteId metadata and the referenced Gutenberg issue. Reproduce the steps with a post containing block-level Notes, then verify that the cloned post no longer retains invalid note metadata and that the original post remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, content
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100