[wp-trac] [WordPress Trac] #40021: Empty p tags when adding multiple consecutive shortcodes in the editor.

WordPress Trac noreply at wordpress.org
Fri Mar 3 10:09:31 UTC 2017


#40021: Empty p tags when adding multiple consecutive shortcodes in the editor.
--------------------------+-----------------------------
 Reporter:  kmgalanakis   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  4.7.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 '''Steps to reproduce'''

 * Create a simple shortcode in your {{{functions.php}}} file.
 {{{#!php
 <?php
 function dummy_div_handler( $atts ){
     return "<div>Lorem ipsum dolor sit amet.</div>";
 }
 add_shortcode( 'dummy-div', 'dummy_div_handler' );
 }}}
 * Add the {{{[dummy-div][dummy-div]}}} shortcodes to a new page using
 either the Visual or the Text editor.

 The markup that is outputted on the browser is

 {{{
 <p><div>Lorem ipsum dolor sit amet.</div><div>Lorem ipsum dolor sit
 amet.</div></p>
 }}}

 which clearly is invalid. The browser processes the page source and
 transforms those  {{{<p>}}} and {{{</p>}}} tags to empty {{{<p>}}} tags by
 adding the missing opening or closing tag, so the resulting markup is
 something like

 {{{
 <p></p><div>Lorem ipsum dolor sit amet.</div><div>Lorem ipsum dolor sit
 amet.</div><p></p>
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40021>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list