[wp-trac] [WordPress Trac] #34722: Open P Tag in shortcode related to h tag

WordPress Trac noreply at wordpress.org
Tue Jan 27 14:48:42 UTC 2026


#34722: Open P Tag in shortcode related to h tag
-------------------------------------------------+-------------------------
 Reporter:  BackuPs                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Formatting                           |     Version:  4.4
 Severity:  normal                               |  Resolution:
 Keywords:  2nd-opinion has-patch changes-       |     Focuses:
  requested                                      |
-------------------------------------------------+-------------------------
Changes (by ozgursar):

 * keywords:  2nd-opinion has-patch needs-testing => 2nd-opinion has-patch
     changes-requested


Comment:

 == Patch Testing Report

 Patch Tested:
 https://core.trac.wordpress.org/attachment/ticket/34722/34722.diff

 === 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. Install and activate Classic Editor
 2. Add the following snippet to create the sample shortcode via Code
 Snippets plugin or functions.php


 {{{
 function theme_shortcode_div($atts, $content = null, $code) {
   $content = $content;
   return '<div class="theme-div">' . $content .'</div>';
 }

 add_shortcode('theme_div', 'theme_shortcode_div');
 }}}

 3. Create a new page or post
 4. Add the following content to test the cases reported by @BackuPs


 {{{
 <h3>Integer in ex vel urna tempor ultrices.</h3> Morbi vehicula a orci nec
 dignissim.
 <hr>
 [theme_div]<h3>Integer in ex vel urna tempor ultrices.</h3> Morbi vehicula
 a orci nec dignissim. [/theme_div]
 <hr>
 [theme_div]<h3>Integer in ex vel urna tempor ultrices.</h3><p>Integer in
 ex vel urna tempor ultrices.Morbi vehicula a orci nec
 dignissim.</p>[/theme_div]
 }}}

 5. View the page/post source code in frontend
 6. Apply the patch
 7. View the page/post source code in frontend again to check if the patch
 passes
 8. ❌ Patch is failing

 === Expected result
 - Extra <p></p> tags still exists at the same place (see screenshots
 before and after)

 === Additional Notes
 - Patch causes the following warnings:

 `Warning: Undefined variable $pee in /var/www/src/wp-
 includes/formatting.php on line 501``
 `Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of
 type array|string is deprecated in /var/www/src/wp-includes/formatting.php
 on line 501`

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

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

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


More information about the wp-trac mailing list