Canonical: Revert redirect when front page's paginated states not found.

r59091 introduced a backward compatibility (BC) break for a static homepage that includes a shortcode's or block's with paginated content that uses the `'paged'` query var, e.g. bbPress.

In this use case, attempting to navigate the shortcode / block's pagination causes a canonical redirect, rather than navigating to the next page of content within that shortcode or block.

Follow-up to [59091].

Props davidbinda, jjj.
See #50163, #meta5184.
Built from https://develop.svn.wordpress.org/trunk@59133


git-svn-id: http://core.svn.wordpress.org/trunk@58529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2024-09-30 18:18:16 +00:00
parent fbcb084305
commit 543ac83971
2 changed files with 5 additions and 6 deletions

View File

@ -749,13 +749,12 @@ class WP {
if ( is_singular() ) {
$post = isset( $wp_query->post ) ? $wp_query->post : null;
$next = '<!--nextpage-->';
$page_qv = is_front_page() ? 'paged' : 'page';
// Check for paged content that exceeds the max number of pages.
if ( $post && ! empty( $this->query_vars[ $page_qv ] ) ) {
if ( $post && ! empty( $this->query_vars['page'] ) ) {
// Check if content is actually intended to be paged.
if ( str_contains( $post->post_content, $next ) ) {
$page = trim( $this->query_vars[ $page_qv ], '/' );
$page = trim( $this->query_vars['page'], '/' );
$content_found = (int) $page <= ( substr_count( $post->post_content, $next ) + 1 );
} else {
$content_found = false;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-59132';
$wp_version = '6.7-alpha-59133';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.