[wp-trac] [WordPress Trac] #37672: wpautop adds a closing p-tag without an opening p-tag
WordPress Trac
noreply at wordpress.org
Wed Jan 28 06:42:38 UTC 2026
#37672: wpautop adds a closing p-tag without an opening p-tag
--------------------------------------+------------------------------
Reporter: TBarregren | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 4.5.3
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Changes (by ozgursar):
* keywords: has-patch has-unit-tests needs-testing => has-patch has-unit-
tests
Comment:
== Patch Testing Report
Patch Tested: https://github.com/WordPress/wordpress-develop/pull/9262
=== Environment
- WordPress: 7.0-alpha-61215-src
- PHP: 8.2.29
- Server: nginx/1.29.4
- Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
- Browser: Chrome 144.0.0.0
- OS: macOS
- Theme: Twenty Twenty-One 2.7
- MU Plugins: None activated
- Plugins:
* Classic Editor 1.6.7
* Code Snippets 3.9.4
* Test Reports 1.2.1
=== Steps taken
1. Create a sample shortcode with the following code using Code Snippets
plugin or functions.php
{{{
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');
}}}
2. Create a new page / post
3. Add the shortcode `[wpautop_test]` to the page content and publish
4. View the post in frontend and check the source code
5. Apply the patch
6. View the post in frontend and check the source code again
7. ✅ Patch is solving the problem
=== Expected result
- After applying the patch `p` tags are correctly added to the shortcode
content.
=== Screenshots/Screencast with results
Before:
[[Image(https://i.imgur.com/XF7FgOa.png)]]
After:
[[Image(https://i.imgur.com/bnQcxPz.png)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37672#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list