Opened 6 weeks ago
Last modified 5 weeks ago
#63148 new defect (bug)
wpautop() formatting function generate invalid HTML if the text end with an empty <p> tag
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | trunk |
Component: | Formatting | Keywords: | has-testing-info has-patch |
Focuses: | Cc: |
Description
It's probably my first ticket (hi there 👋 !).
When preparing a migration of an old WordPress, I was facing the following issue:
<?php $text = "<p>test</p> <p></p>"; var_dump(wpautop($text); // Output: string(16) "<p>test</p></p> // "
You may ask, but why do you need to apply wpautop()
on an already formatted text?
Because some of the content needed it (paragraphs only separated by newlines) and some was already formatted with HTML and Classic Editor.
My current countermeasure is to test if the content already have <p>
and don't apply wpautop()
.
Is this a know issue (I found nothing when searching) ?
Change History (2)
This ticket was mentioned in PR #8569 on WordPress/wordpress-develop by @sukhendu2002.
5 weeks ago
#2
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/63148
Note: See
TracTickets for help on using
tickets.
Welcome @gillesdoge to Trac
Reproduction Report
Description
This report validates that the issue can be reproduced.
Environment
Actual Results
Supplemental Artifacts