[wp-trac] [WordPress Trac] #38656: wpautop incorrectly handling paragraphs within block elements

WordPress Trac noreply at wordpress.org
Thu Jan 29 14:22:11 UTC 2026


#38656: wpautop incorrectly handling paragraphs within block elements
-------------------------------------------------+-------------------------
 Reporter:  pento                                |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Formatting                           |     Version:  5.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-        |     Focuses:
  screenshots has-test-info                      |
-------------------------------------------------+-------------------------
Changes (by ozgursar):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests has-
     screenshots has-test-info


Comment:

 Thanks for fixing the patch @vladimiraus
 I was able to apply the PR and verify that the patch works as expected.

 == Patch Testing Report

 Patch Tested: https://github.com/WordPress/wordpress-develop/pull/10817

 === 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-Five 1.4
 - MU Plugins: None activated
 - Plugins:
   * Code Snippets 3.9.4
   * Test Reports 1.2.1

 === Steps taken
 1. Add the following sample shortcode via Code Snippets 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 post
 3. Add the shortcode [wpautop_test]
 4. View the generated source code on the frontend
 5. Apply the patch
 6. View the generated source code on the frontend again to see the changes
 7. ✅ Patch is solving the problem

 === Expected result
 - We are expecting to see the p tags properly added to the shortcode
 content.

 === Screenshots/Screencast with results
 Before:
 [[Image(https://i.imgur.com/XddSQBj.png)]]

 After:
 [[Image(https://i.imgur.com/m9JIYGe.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/38656#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list