diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php
index 24a3ffb9db..1fcd80e18d 100644
--- a/b2-include/b2functions.php
+++ b/b2-include/b2functions.php
@@ -66,18 +66,19 @@ function wptexturize($text) {
function wpautop($pee, $br=1) {
$pee = preg_replace('|
\s*
|', "\n\n", $pee);
+ $pee = preg_replace('!(<(?:table|ul|ol|li|pre|select|form|blockquote)[^>]*>)!', "\n$1", $pee); // Space things out a little
$pee = preg_replace("/(\r\n|\n|\r)/", "\n", $pee); // cross-platform newlines
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
$pee = preg_replace('/\n?(.+?)(\n\n|\z)/s', "
$1
\n", $pee); // make paragraphs, including one at the end - $pee = str_replace('', '
', $pee); - $pee = str_replace('
', '', $pee); + $pee = preg_replace('|\s*
|', '
', $pee); + $pee = preg_replace('|
\s*|', '', $pee); + $pee = preg_replace('|]*)>|i', "', $pee); $pee = preg_replace('!', '", $pee); + $pee = str_replace('
\s*(?(?:table|ul|ol|li|pre|select|form|blockquote)[^>]*>)!', "$1", $pee); $pee = preg_replace('!(?(?:table|ul|ol|li|pre|select|form|blockquote)>)\s*
!', "$1", $pee); if ($br) $pee = preg_replace('|(?)\s*\n|', "]*)>|i', "', $pee); $pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $pee); return $pee;', '", $pee); - $pee = str_replace('