-
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
Inconsistent handling of line breaks in excerpts #15117
Comments
Please note that the issue does not specifically apply only to Gutenberg, but more in general to content created in any other method than the "Classic" editor, including page builders, like Elementor in my case. Line breaks should really be handled in the same way as paragraphs in the creation of the excerpt, therefore they should be correctly replaced with a white space in order to avoid unreadable, sticked together texts in excerpts. Are there any updates about the resolution of this bug? |
Hi,
I would like to know if it could break something or it can generate some unexpected side effects. |
ping @richtabor / @ndiego |
@mtias @priethor @andreiglingeanu |
Confirmed in WooCommerce with TwentyTwentyFour theme, short description of products just ignores any kind of formatting, bold, titles, line jumps, etc. That makes it pretty limiting to work with. Also I couldn't find any workaround yet, awaiting for a fix. Likely, WooCommerce will fix it by integrating Gutenberg editor before the fix is released for core WP, which would be a first. |
I'm using TwentyTwentyFour theme and have the same problem with the short product description. |
Since all the other slightly different issues have been closed in favor of this one, and I haven't seen it included here yet, thought I'd mention that this workaround has been useful for us so far: https://core.trac.wordpress.org/ticket/59270#comment:5 Of course, it's not an ideal long-term workaround since it would in theory break the excerpt length setting in the block, once that is finally fixed, but for now it's been working well enough for our purposes. |
@CooperatusTeam I'm not sure I understand how to apply this workaround ? Could you help me out ? |
@azsde You can probably add the filter referenced in the workaround through using a snippets plugin, or include it in a child theme (the latter is what I did since we were using our own theme anyway). There's more info about filters and how to use them here: https://learn.wordpress.org/tutorial/wordpress-filter-hooks/ |
@CooperatusTeam alright, if I understand correctly the modification should be done directly in the php file then ? |
Line breaks are handled differently in Gutenberg blocks vs classic blocks
When generating excerpts, Wordpress 5.x strips out the
<br>
tags in Gutenberg blocks, but it replaces them with a normal space (” “) in Classic blocks.To reproduce
in the code editor)
Expected behavior
Line breaks (with
<br>
) should always be replaced with a normal space (" ") in excerpts.Screenshots
Compare "This is just to say 1" (classic block) with "This is just to say 2" (Gutenberg "paragraph" block).
Desktop (please complete the following information):
n/a
Smartphone (please complete the following information):
n/a
Additional context
The text was updated successfully, but these errors were encountered: