Make WordPress Core


Ignore:
Timestamp:
09/30/2024 06:16:18 PM (2 months ago)
Author:
hellofromTonya
Message:

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.

File:
1 edited

Legend:

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

    r59091 r59133  
    748748
    749749            if ( is_singular() ) {
    750                 $post    = isset( $wp_query->post ) ? $wp_query->post : null;
    751                 $next    = '<!--nextpage-->';
    752                 $page_qv = is_front_page() ? 'paged' : 'page';
     750                $post = isset( $wp_query->post ) ? $wp_query->post : null;
     751                $next = '<!--nextpage-->';
    753752
    754753                // Check for paged content that exceeds the max number of pages.
    755                 if ( $post && ! empty( $this->query_vars[ $page_qv ] ) ) {
     754                if ( $post && ! empty( $this->query_vars['page'] ) ) {
    756755                    // Check if content is actually intended to be paged.
    757756                    if ( str_contains( $post->post_content, $next ) ) {
    758                         $page          = trim( $this->query_vars[ $page_qv ], '/' );
     757                        $page          = trim( $this->query_vars['page'], '/' );
    759758                        $content_found = (int) $page <= ( substr_count( $post->post_content, $next ) + 1 );
    760759                    } else {
Note: See TracChangeset for help on using the changeset viewer.