[wp-trac] [WordPress Trac] #41531: problem with wpautop

WordPress Trac noreply at wordpress.org
Sun Sep 3 12:43:18 UTC 2017


#41531: problem with wpautop
--------------------------+------------------------------
 Reporter:  parsmizban    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  4.8
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by brutalenemy666):

 '''Reason'''

 The gaps, spaces and tabs before closing block tags are converted into
 empty paragraphs.

 `wpautop`, however, removes the opening `<p>` tag and leaves the closing
 `</p>`.

 '''Possible Solution'''

 I am removing the empty paragraphs followed by any closing block element,
 before removing the opening and closing paragraph tags separatedly.

 '''Code to test with'''

 {{{#!php
 ob_start();
 ?>
 <div><div>correct</div></div>

 <div>
     <div>correct</div>
 </div>

 <div>
     <div>incorrect</div>
     </div>
 <?php
 $content = ob_get_clean();
 print_r( wpautop($content) ); exit;
 }}}

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


More information about the wp-trac mailing list