Remove the `core/more` block delimiters when splitting post_content on the `<!--more-->` tag.

Fixes:
- Parsing of blocks in the second half of post_content.
- Outputting malformed HTML when `the_content( null, true )` or  `<!--noteaser-->` is used.

Props lukecarbis, garrett-eclipse, birgire.
Fixes #46471.
Built from https://develop.svn.wordpress.org/trunk@45261


git-svn-id: http://core.svn.wordpress.org/trunk@45070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2019-04-24 05:40:52 +00:00
parent 0da8c2265f
commit df438d90a0
2 changed files with 7 additions and 1 deletions

View File

@ -314,7 +314,13 @@ function get_the_content( $more_link_text = null, $strip_teaser = false, $post =
$page_no = $elements['page'];
$content = $elements['pages'][ $page_no - 1 ];
if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
if ( has_block( 'more', $content ) ) {
// Remove the core/more block delimiters. They will be left over after $content is split up.
$content = preg_replace( '/<!-- \/?wp:more(.*?) -->/', '', $content );
}
$content = explode( $matches[0], $content, 2 );
if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
$more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-beta3-45260';
$wp_version = '5.2-beta3-45261';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.