WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 months ago

#17778 closed defect (bug) (fixed)

get_comment_pages_count() returns > 1 when pagination is disabled

Reported by: dd32 Owned by: nacin
Milestone: 3.7 Priority: normal
Severity: normal Version: 2.7
Component: Comments Keywords: has-patch commit
Focuses: Cc:

Description

If pagination is disabled, get_comment_pages_count() will still return the number of pages possible if pagination was enabled.

As a workaround, themes & TwentyEleven are having to get to see if pagination is enabled first:

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>

I'd suggest that if comment pagination is not enabled, this function should return 0 or 1 (0 = no comments, 1 = 1 page).

The addition of an extra block after the empty comments check would be:

if ( ! get_option('page_comments') )
	return 1;

Attachments (3)

comment.php.patch (537 bytes) - added by kobenland 3 years ago.
17778.patch (4.3 KB) - added by jakub.tyrcha 3 years ago.
17778.refresh.patch (413 bytes) - added by c3mdigital 8 months ago.
Refresh of original patch

Download all attachments as: .zip

Change History (9)

kobenland3 years ago

comment:1 kobenland3 years ago

  • Cc kobenland added

comment:2 jakub.tyrcha3 years ago

  • Keywords has-patch added

Refreshed and tweaked the patch, + updated formatting in the function

jakub.tyrcha3 years ago

c3mdigital8 months ago

Refresh of original patch

comment:3 c3mdigital8 months ago

  • Version changed from 3.2 to 2.7

comment:4 SergeyBiryukov8 months ago

  • Milestone changed from Awaiting Review to 3.7

comment:5 SergeyBiryukov8 months ago

  • Keywords commit added

comment:6 nacin8 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 25126:

Return 1 from get_comment_pages_count() when pagination is disabled.

props obenland.
fixes #17778.

Note: See TracTickets for help on using tickets.