Opened 2 years ago

Last modified 23 months ago

#17778 new defect (bug)

get_comment_pages_count() returns > 1 when pagination is disabled

Reported by: dd32 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Comments Version: 3.2
Severity: normal Keywords: has-patch
Cc: kobenland

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 (2)

comment.php.patch (537 bytes) - added by kobenland 2 years ago.
17778.patch (4.3 KB) - added by jakub.tyrcha 23 months ago.

Download all attachments as: .zip

Change History (4)

  • Cc kobenland added
  • Keywords has-patch added

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

Note: See TracTickets for help on using tickets.