Make WordPress Core

Ticket #45495: do_blocks.diff

File do_blocks.diff, 1.1 KB (added by aldavigdis, 6 years ago)

A patch that cures the issue

  • src/wp-includes/blocks.php

     
    262262 * @return string Updated post content.
    263263 */
    264264function do_blocks( $content ) {
    265         // If there are blocks in this content, we shouldn't run wpautop() on it later.
    266         $priority = has_filter( 'the_content', 'wpautop' );
    267         if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
    268                 remove_filter( 'the_content', 'wpautop', $priority );
    269                 add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
    270         }
    271 
    272265        $blocks = parse_blocks( $content );
    273266        $output = '';
    274267
     
    276269                $output .= render_block( $block );
    277270        }
    278271
     272        // If there are blocks in this content, we shouldn't run wpautop() on it later.
     273        $priority = has_filter( 'the_content', 'wpautop' );
     274        if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
     275                remove_filter( 'the_content', 'wpautop', $priority );
     276                add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
     277        }
     278
    279279        return $output;
    280280}