mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@45261 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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] ) ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user