-
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
Filtered post content is truncated in post-content block #68605
Comments
Related #68614. |
Since this issue is likely to first appear in Gutenberg 20.0, i.e. the WP 6.8 release, I will add it to the project board. |
Resharing @PaulREnglish's finding, which matches the ones in the description - #68614 (comment). |
Noting I'm getting this as well—my blog. Any ideas to resolve? 😬 |
In any case, it seems necessary to fix the echo ( remove_serialized_parent_block( 'Hello World') );
// Output: lo Wo
echo ( remove_serialized_parent_block( '<p>Hello World</p>') );
// Otuput: Hello World< |
@audrasjb re-opened related Trac ticket - https://core.trac.wordpress.org/ticket/61074. So, functions like |
I can confirm that I've seen the same problem that @richtabor reported in #68605 (comment). It was for the post authored with blocks, so the comment mentioned by @Mamaduka will probably be needed but it won't cover all issues. There is Other reports need to be further investigated. |
Thanks for the ping! I'll work on a fix. |
I think the correct fix will be to absorb the The problem is that these operations aren't "atomic" at the moment. Consider the relevant code in the Post Content block: gutenberg/packages/block-library/src/post-content/index.php Lines 57 to 74 in 183f671
We're adding the parent block wrapper on L59-63. We then add the As @ryelle pointed out, this breaks the moment that another So I don't think we should fix this by making |
Turns out I've already filed a ticket for that: https://core.trac.wordpress.org/ticket/62716 |
PR (WIP): #68926 |
When the content is filtered with
the_content
filter, the replaced content is truncated because it's not wrapped in thepost-content
block.Screenshots of the issue
On Five for the Future we inject the company description:
In "notice" blocks, we run
the_content
to parse markup:To reproduce
123456789
456
.More details
This is due to #67272 adding
add_filter( 'the_content', 'remove_serialized_parent_block', 8 );
, and remove_serialized_parent_block does not check for serialized blocks before runningsubstr
. This results in it trimming from 3, -3 if there is no wrapper.Additionally, any blocks that run
the_content
on attributes are also truncated, as this filter runs in the course of rendering the block.I'm not sure if the better solution is to add a check in
remove_serialized_parent_block
, or to change how the filter is applied incore/post-content
, but I'm happy to draft a core patch if needed.The text was updated successfully, but these errors were encountered: