From 4c636c6ec87382db7f21d725c352f6909ffa2d4a Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 17 Dec 2018 19:28:49 +0000 Subject: [PATCH] Query: Remove nextpage block delimiters when setting up global post data. `WP_Query::setup_postdata()` splits the post up by ``, which causes invalid block data to be contained in the post content. This change removes the `` and ``, as well. Props pento, youknowriad, azaozz, noisysocks. Merges [43940] into trunk. See #45401. git-svn-id: https://develop.svn.wordpress.org/trunk@44276 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-query.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index ddfd6fc7d2..e569e02ef1 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -4164,6 +4164,10 @@ class WP_Query { $content = str_replace( "\n", '', $content ); $content = str_replace( "\n", '', $content ); + // Remove the nextpage block delimiters, to avoid invalid block structures in the split content. + $content = str_replace( '', '', $content ); + $content = str_replace( '', '', $content ); + // Ignore nextpage at the beginning of the content. if ( 0 === strpos( $content, '' ) ) { $content = substr( $content, 15 );