Make WordPress Core


Ignore:
Timestamp:
02/21/2017 03:41:42 AM (7 years ago)
Author:
dd32
Message:

Formatting: fix wpautop() to stop adding paragraph tags around <figcaption>.

Props azaozz, pbearne for tests.
Merges [39912], [39914] to the 4.7 branch.
Fixes #39307 for 4.7.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/formatting.php

    r39326 r40091  
    505505        $pee = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $pee );
    506506        $pee = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee );
     507    }
     508
     509    // Collapse line breaks before and after <figcaption> elements.
     510    if ( strpos( $pee, '<figcaption' ) !== false ) {
     511        $pee = preg_replace( '|\s*(<figcaption[^>]*>)|', '$1', $pee );
     512        $pee = preg_replace( '|</figcaption>\s*|', '</figcaption>', $pee );
    507513    }
    508514
Note: See TracChangeset for help on using the changeset viewer.