Make WordPress Core

Changeset 35934


Ignore:
Timestamp:
12/14/2015 07:56:14 PM (11 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.

Merges [35933] to the 4.4 branch.

Fixes #34946.

Location:
branches/4.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4

  • branches/4.4/src/wp-includes/comment-template.php

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

    r35331 r35934  
    121121                $this->assertContains( 'cpage=3', $found );
    122122        }
     123
     124        /**
     125         * @ticket 34946
     126         */
     127        public function test_should_not_contain_comment_page_1_when_pagination_is_disabled() {
     128                $this->set_permalink_structure( '/%postname%/' );
     129                update_option( 'page_comments', 0 );
     130
     131                $found = get_comment_link( self::$comments[1] );
     132
     133                $this->assertNotContains( 'comment-page-1', $found );
     134        }
    123135}
Note: See TracChangeset for help on using the changeset viewer.