diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 993c3af50e..973eb0ba78 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -492,8 +492,7 @@ function wpautop( $pee, $br = true ) {
// Change multiple
s into two line breaks, which will turn into paragraphs.
$pee = preg_replace( '|
\s*
|', "\n\n", $pee );
- $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)\b';
- $allblocksexceptp = str_replace( '|p|', '|', $allblocks );
+ $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
// Add a double line break above block-level opening tags.
$pee = preg_replace( '!(<' . $allblocks . '[\s/>])!', "\n\n$1", $pee );
@@ -559,12 +558,12 @@ function wpautop( $pee, $br = true ) {
// Under certain strange conditions it could create a P of entirely whitespace.
$pee = preg_replace( '|
\s*
|', '', $pee ); - // If an opening or closing block element tag is wrapped in a, unwrap it. - $pee = preg_replace( '!
\s*(?' . $allblocks . '[^>]*>)\s*
!', '$1', $pee ); - // Add a closinginside