[wp-trac] [WordPress Trac] #31695: Extra unclosed <p> tag before <script> breaking the_content()

WordPress Trac noreply at wordpress.org
Thu Jul 23 12:51:15 UTC 2015


#31695: Extra unclosed <p> tag before <script> breaking the_content()
-------------------------------------------------+-------------------------
 Reporter:  vaurdan                              |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Formatting                           |  Review
 Severity:  normal                               |     Version:
 Keywords:  needs-unit-tests wpautop needs-      |  Resolution:
  patch                                          |     Focuses:
-------------------------------------------------+-------------------------

Comment (by vaurdan):

 I was able to reproduce the bug in the last trunk version, in a clean
 install with twentyfifteeen and no plugins. Here are the steps:

 1. Create a new post with a Twitter link.
 2. Save the post
 3. Check the HTML that was generated for the tweet. It will contain a
 valid HTML:
 {{{
 (...)
 <p><script async src="//platform.twitter.com/widgets.js"
 charset="utf-8"></script></p>
 }}}
 4. Edit `tentyfifteen/functions.php` and add the following code:
 {{{
 function break_embed( $html ) {
     return '<div> ' . $html . '</div>';
 }
 add_filter( 'embed_oembed_html', 'break_embed' );
 }}}
 5. Check the HTML again, you will see that it is now missing the final
 `</p>`:
 {{{
 (...)
 <p><script async src="//platform.twitter.com/widgets.js"
 charset="utf-8"></script>
 }}}

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


More information about the wp-trac mailing list