Opened 9 years ago
Last modified 4 months ago
#37672 new defect (bug)
wpautop adds a closing p-tag without an opening p-tag
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | 4.5.3 |
| Component: | Formatting | Keywords: | has-patch has-unit-tests needs-testing |
| Focuses: | Cc: |
Description
Following code result in ill-formed HTML.
<?php $pee = <<<EOT <div> This is a paragraph. This is another paragraph. </div> EOT; echo wpautop($pee);
This is the output:
<div> This is a paragraph.</p> <p>This is another paragraph. </p></div>
As you can see, the first paragraph lacks an opening <p>.
Attachments (1)
Change History (7)
#3
@
9 years ago
@TBarregren
Thank for your report - I can reproduce this with a unit test and I think I've also managed to create a fix in the 'wpautop()' function. Patch and Unit test attached above.
#5
@
7 years ago
- Keywords needs-refresh added
@MattyRob are you able to refresh 37672.diff to apply cleanly to trunk? Having a unit test demonstrating the issue may help others dive in.
This ticket was mentioned in PR #9262 on WordPress/wordpress-develop by @lakshyajeet.
4 months ago
#6
- Keywords needs-refresh removed
Trac ticket: https://core.trac.wordpress.org/ticket/37672
Code used in testing:
function wpautop_test_shortcode() {
$text = <<<EOT
<div>
This is a paragraph.
This is another paragraph.
</div>
EOT;
return wpautop($text);
}
add_shortcode('wpautop_test', 'wpautop_test_shortcode');
Note: See
TracTickets for help on using
tickets.
If it is to any help, this is my function.php code to solve this (and related) problem(s).