-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Several blocks with the anchor are broken in the update #48232
Comments
This issue might be related to #44771.
As mentioned above, I think that the changes made in #44771 might have unintentionally affected static blocks. |
Cc @Soean |
Maybe we should check, if the block has a render callback. |
I think the render callback is not limited to dynamic blocks but is also used to rewrite output on the front end. For example, A static block with a render callback will have extra comments added as follows: <!-- From -->
<!-- wp:heading -->
<h2 id="my-heading">Test</h2>
<!-- /wp:heading -->
<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large" id="my-image"><img src="https://live.staticflickr.com/4572/38004374914_6b686d708e_b.jpg" alt=""/></figure>
<!-- /wp:image -->
<!-- To -->
<!-- wp:heading {"anchor":"my-heading"} -->
<h2 class="wp-block-heading" id="my-heading">Test</h2>
<!-- /wp:heading -->
<!-- wp:image {"sizeSlug":"large","anchor":"my-image"} -->
<figure class="wp-block-image size-large" id="my-image"><img src="https://live.staticflickr.com/4572/38004374914_6b686d708e_b.jpg" alt=""/></figure>
<!-- /wp:image --> I think we should check if the |
As far as I know, I think there is no way for PHP to determine if the block needs to save the anchor attribute as a comment. Therefore, I propose the following approach.
|
The dynamic block anchor support that caused this problem has been reverted in WordPress 6.2 (See this comment). This problem needs to be fixed when re-adding anchor support for dynamic blocks in the future. Therefore, move to "Punted to 6.3" on the project board. |
Update: This issue is being attempted to be fixed in #48438. |
I think the changes should have been reverted from the plugin too since this is about losing all the content in a group block with an anchor set. The block recovery won't help here either. What are the next steps? |
Update: I have left a comment on how this issue should be addressed in the PR that will correct this problem. |
Update: As mentioned in this comment, I have submitted #51288 to remove anchor support for dynamic blocks in order to find a more ideal solution. After this PR is merged, I would like to close this issue and submit a new issue to consider re-adding anchor support for dynamic blocks. |
In WordPress 6.1.1, if the content contains blocks with the anchor, updating to WordPress 6.2 Beta2 will break some blocks.
I created the following content in WordPress 6.1.1:
If you update this environment to WordPress 6.2, the markup will change as follows:
A comparison of the markups confirms the following three points:
p
elementanchor
attributes has been added to the heading blockNow save the post, updating only the title, and reload the browser. Then the block will be broken as follows:
The browser console displays the following error:
The text was updated successfully, but these errors were encountered: