diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 85ffa7d93c..fd6676724d 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -157,8 +157,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { } } - if ( get_query_var( 'page' ) && $wp_query->post && - false !== strpos( $wp_query->post->post_content, '' ) ) { + if ( get_query_var( 'page' ) && $wp_query->post ) { $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' ); $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); $redirect_url = get_permalink( $wp_query->post->ID ); diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php index 783a993cdc..e5dadcd232 100644 --- a/wp-includes/class-wp.php +++ b/wp-includes/class-wp.php @@ -678,9 +678,14 @@ class WP { // Check for paged content that exceeds the max number of pages. $next = ''; - if ( $p && false !== strpos( $p->post_content, $next ) && ! empty( $this->query_vars['page'] ) ) { - $page = trim( $this->query_vars['page'], '/' ); - $success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 ); + if ( $p && ! empty( $this->query_vars['page'] ) ) { + // Check if content is actually intended to be paged. + if ( false !== strpos( $p->post_content, $next ) ) { + $page = trim( $this->query_vars['page'], '/' ); + $success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 ); + } else { + $success = false; + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 98018b4896..61d02e2fa6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47706'; +$wp_version = '5.5-alpha-47727'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.