WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/30/2020 12:03:11 PM (21 months ago)
Author:
SergeyBiryukov
Message:

Canonical: Redirect paged requests for non-paginated posts to the post permalink.

This avoids displaying duplicate content of the same post under different URLs and ensures the canonical URL is correct.

Previously, requests for invalid page numbers were only redirected to the post permalink if the post was actually paginated using the <!--nextpage--> marker.

Follow-up to [34492].

Props jeremyfelt, prografika, sachit.tandukar, subrataemfluence, hronak, ekatherine, henry.wright, chesio, dd32, SergeyBiryukov.
Fixes #40773. See #45337, #28081, #11694.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/link/wpGetCanonicalURL.php

    r46586 r47727  
    1212        self::$post_id = $factory->post->create(
    1313            array(
    14                 'post_status' => 'publish',
     14                'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3',
     15                'post_status'  => 'publish',
    1516            )
    1617        );
Note: See TracChangeset for help on using the changeset viewer.