WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/24/2019 05:40:01 AM (11 months ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r45088 r45261  
    315315    $content = $elements['pages'][ $page_no - 1 ];
    316316    if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
     317        if ( has_block( 'more', $content ) ) {
     318            // Remove the core/more block delimiters. They will be left over after $content is split up.
     319            $content = preg_replace( '/<!-- \/?wp:more(.*?) -->/', '', $content );
     320        }
     321
    317322        $content = explode( $matches[0], $content, 2 );
     323
    318324        if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
    319325            $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
Note: See TracChangeset for help on using the changeset viewer.