Make WordPress Core

Changeset 35933


Ignore:
Timestamp:
12/14/2015 07:45:45 PM (9 years ago)
Author:
boonebgorges
Message:

Omit cpage query var in comment link if comment pagination is disabled.

WP 4.4 changed the way comment pagination is calculated. See #8071. In the
context of get_comment_link(), these changes introduced a regression that
causes cpage (or its pretty-permalink correlate comment-page-x) to appear
in comment links when comment pagination is disabled. The current changeset
fixes the regression.

Fixes #34946.

Location:
trunk
Files:
2 edited

Legend:

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

    r35931 r35933  
    737737    }
    738738
    739     if ( $cpage ) {
     739    if ( $cpage && get_option( 'page_comments' ) ) {
    740740        if ( $wp_rewrite->using_permalinks() ) {
    741741            if ( $cpage ) {
  • trunk/tests/phpunit/tests/comment/getCommentLink.php

    r35858 r35933  
    129129        $this->assertContains( 'cpage=3', $found );
    130130    }
     131
     132    /**
     133     * @ticket 34946
     134     */
     135    public function test_should_not_contain_comment_page_1_when_pagination_is_disabled() {
     136        $this->set_permalink_structure( '/%postname%/' );
     137        update_option( 'page_comments', 0 );
     138
     139        $found = get_comment_link( self::$comments[1] );
     140
     141        $this->assertNotContains( 'comment-page-1', $found );
     142    }
    131143}
Note: See TracChangeset for help on using the changeset viewer.