WordPress.org

Make WordPress Core

Ticket #7988: wpautop.morespecific.7988.diff

File wpautop.morespecific.7988.diff, 885 bytes (added by filosofo, 6 years ago)
  • wp-includes/formatting.php

     
    134134        foreach ( $pees as $tinkle ) 
    135135                $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n"; 
    136136        $pee = preg_replace('|<p>\s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 
    137         $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee); 
     137        $pee = preg_replace('#<p>\s*?(?!</)(\S.*)(</(?:address|div|form)[^>]*>)#', "<p>$1</p>$2", $pee);  
    138138        $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag 
    139139        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists 
    140140        $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);