diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 12e5bee017..e2c8aef269 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -500,6 +500,9 @@ function wpautop( $pee, $br = true ) { // Add a double line break below block-level closing tags. $pee = preg_replace( '!()!', "$1\n\n", $pee ); + // Add a double line break after hr tags, which are self closing. + $pee = preg_replace( '!()!', "$1\n\n", $pee ); + // Standardize newline characters to "\n". $pee = str_replace( array( "\r\n", "\r" ), "\n", $pee ); diff --git a/tests/phpunit/tests/formatting/Autop.php b/tests/phpunit/tests/formatting/Autop.php index 3f44949fe2..405b68ad34 100644 --- a/tests/phpunit/tests/formatting/Autop.php +++ b/tests/phpunit/tests/formatting/Autop.php @@ -312,7 +312,6 @@ Paragraph two.'; 'h4', 'h5', 'h6', - 'hr', 'fieldset', 'legend', 'section', @@ -558,4 +557,13 @@ line 2
$this->assertEquals( $expected2, trim( wpautop( $content2 ) ) ); } + /** + * @ticket 14674 + */ + function test_the_hr_is_not_peed() { + $content = 'paragraph1
paragraph2'; + $expected = "

paragraph1

\n
\n

paragraph2

"; + + $this->assertEquals( $expected, trim( wpautop( $content ) ) ); + } }