Formatting: fix wpautop() to stop adding paragraph tags around <figcaption>.
Fixes #39307 for trunk. Built from https://develop.svn.wordpress.org/trunk@39912 git-svn-id: http://core.svn.wordpress.org/trunk@39849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -506,6 +506,12 @@ function wpautop( $pee, $br = true ) {
|
||||
$pee = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee );
|
||||
}
|
||||
|
||||
// Collapse line breaks before and after <figcaption> elements.
|
||||
if ( strpos( $pee, '<figcaption' ) !== false ) {
|
||||
$pee = preg_replace( '|\s*(<figcaption[^>]*>)|', '$1', $pee );
|
||||
$pee = preg_replace( '|</figcaption>\s*|', '</figcaption>', $pee );
|
||||
}
|
||||
|
||||
// Remove more than two contiguous line breaks.
|
||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user