Make WordPress Core

Ticket #27530: 27530.diff

File 27530.diff, 699 bytes (added by dkotter, 9 years ago)
  • wp-includes/formatting.php

     
    513513
    514514        // Rebuild the content as a string, wrapping every bit with a <p>.
    515515        foreach ( $pees as $tinkle ) {
    516                 $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
     516                $tinkle = trim( $tinkle, "\n" );
     517
     518                // If this bit starts with a closing tag, don't wrap in paragraphs.
     519                if ( '</' === substr( $tinkle, 0, 2 ) ) {
     520                        $pee .= $tinkle . "\n";
     521                } else {
     522                        $pee .= '<p>' . $tinkle . "</p>\n";
     523                }
    517524        }
    518525
    519526        // Under certain strange conditions it could create a P of entirely whitespace.