Opened 3 years ago
Last modified 8 months ago
#15367 assigned defect (bug)
WordPress strips multiple line breaks inside of <pre> tags
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Formatting | Version: | 3.1 |
| Severity: | normal | Keywords: | 3.2-early wpautop needs-testing has-patch needs-refresh |
| Cc: | MikeHansenMe |
Description
Write a post:
<pre> This is a test. </pre>
You end up with this:
<pre> This is a test. </pre>
Probably related to wpautop() I imagine.
Attachments (1)
Change History (16)
comment:1
Viper007Bond — 3 years ago
- Keywords needs-patch added
comment:3
follow-up:
↓ 4
Viper007Bond — 3 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
This isn't a TinyMCE issue, it's an output filter issue.
Replying to Viper007Bond:
The same was happening when switching editors, perhaps we can apply the changes from the JS version of wpautop to the php one.
comment:5
Viper007Bond — 3 years ago
No I mean this isn't an editor issue. If I write the above example in the HTML editor, it stays exactly like that. I save the post, still correct. When I view it on the front end however, the extra line breaks are stripped out.
comment:6
Viper007Bond — 3 years ago
Whoops, I need to learn to read. Yes, we need to apply the code to the PHP-based `wpautp()~ too.
comment:7
Viper007Bond — 3 years ago
I also need to learn to spell apparently...
Nah you can spell apparently fairly well it's the other words you should practice ;-)
- Keywords 3.2-early wpautop added
- Milestone changed from Awaiting Review to Future Release
comment:10
garyc40 — 2 years ago
- Owner set to garyc40
- Status changed from reopened to assigned
Related: #18534
comment:12
TomAuger — 19 months ago
- Keywords needs-testing added
My approach was to preserve all content inside <pre> tags from most of the substitution that occurs on the rest of the text. As a result, the call to clean_pre() is no longer necessary.
- Keywords has-patch added; needs-patch removed
Closed #19666 as a duplicate.
comment:14
MikeHansenMe — 8 months ago
- Cc MikeHansenMe added
- Keywords needs-refresh added
This problem still exists but the patch would not apply. Needs Refresh.
comment:15
MikeHansenMe — 8 months ago
In addition to my last comment the problem still exist when switching between Visual and Text mode. If you paste the example in text mode and click publish then reload the page it remains as it should. It seems a similar fix is needed for the js.

(In [16394]) Remove invalid parent paragraph when pasting in the visual editor or switching visual to HTML and back, keep multiple empty lines in a <pre> tag, fixes #15095 fixes #15367