[wp-trac] [WordPress Trac] #43387: wpautop() adds "</p>" where it should not

WordPress Trac noreply at wordpress.org
Tue Sep 18 14:07:41 UTC 2018


#43387: wpautop() adds "</p>" where it should not
--------------------------+------------------------------
 Reporter:  1994rstefan   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by dionysous):

 We encounter this problem on our sites, too. Users reported, that `</p>`
 is added after an `<img>` tag, which comes right before an opening `<div>`
 tag.

 Input in the editor:

 {{{
 <div class="image-grid"><img class="alignnone size-full wp-image-570"
 src="{{IMG_URL}}" alt="" />
 <div class="overlay"><img class="alignnone size-full wp-image-573"
 src="{{IMG_URL}}" alt="" /></div>
 </div>
 }}}

 Output in frontend:

 {{{
 <div class="image-grid"><img class="alignnone size-full wp-image-570"
 src="{{IMG_URL}}" alt="" /></p>
 <div class="overlay"><img class="alignnone size-full wp-image-573"
 src="{{IMG_URL}}" alt="" /></div>
 </div>
 }}}

 It is quite easy to reproduce.

 We run automatted tests on our websites, invalid HTML is shown as an
 error. This happening quite often. The users ask us to fix this problem,
 but it seems to be a bug in the WP core, more precisely in the ''wpautop''
 function.

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


More information about the wp-trac mailing list