Make WordPress Core


Ignore:
Timestamp:
06/08/2021 10:49:27 PM (3 years ago)
Author:
whyisjake
Message:

Permalinks: Limit pagination for posts with comments.

Additionally, redirect pages back to the source page if comments don't exist.

Props devrekli, carike, sumanm, mukesh27, chaion07, audrasjb, whyisjake, SergeyBiryukov.

Fixes #50233.

File:
1 edited

Legend:

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

    r50452 r51118  
    153153
    154154    /**
     155     * Limit pagination for comments.
     156     *
     157     *  @ticket 50233
     158     */
     159    public function test_comments_limit_paged_with_plain_permalink_structure() {
     160        $cpage = 5;
     161
     162        $link = add_query_arg(
     163            array(
     164                'cpage' => $cpage,
     165                'foo'   => 'bar',
     166            ),
     167            get_permalink( self::$post_id )
     168        );
     169
     170        $this->go_to( $link );
     171        $expected = get_permalink( self::$post_id ) . '#comments';
     172        $this->assertSame( $expected, wp_get_canonical_url( self::$post_id ) );
     173    }
     174
     175    /**
    155176     * Filter callback for testing of filter usage.
    156177     *
Note: See TracChangeset for help on using the changeset viewer.