WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#39792 closed enhancement (fixed)

get_the_comments_pagination should accept the list type argument

Reported by: poena Owned by: SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.7.1
Component: Themes Keywords: has-patch needs-testing
Focuses: Cc:
PR Number:

Description

get_the_comments_pagination uses paginate_links, which allows the following type arguments:
'plain', 'array' and 'list'. Default is 'plain'.

But compared to get_the_posts_pagination that changes 'array' to 'plain' but allows the 'list' type, get_the_comments_pagination always sets it to 'plain'.

Comments:

// Make sure we get plain links, so we get a string we can work with.
$args['type'] = 'plain';

https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/link-template.php#L2868

Posts:

// Make sure we get a string back. Plain is the next best thing.
if ( isset( $args['type'] ) && 'array' == $args['type'] ) {
    $args['type'] = 'plain';
}

https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/link-template.php#L2527

Attachments (1)

39792.diff (604 bytes) - added by jainnidhi 3 years ago.
Patch attached.

Download all attachments as: .zip

Change History (4)

@jainnidhi
3 years ago

Patch attached.

#1 @jainnidhi
3 years ago

  • Keywords has-patch needs-testing added

I've attached a patch 39792.diff

#2 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 4.9

Changed in [30820] for get_the_posts_pagination().

get_the_comments_pagination() was introduced later in [34367], but didn't get this change. Seems like an oversight.

#3 @SergeyBiryukov
2 years ago

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

In 41236:

Link Template: Allow the type argument to be passed through get_the_comments_pagination() as long as its value isn't array.

See [30820] for `get_the_posts_pagination().

Props jainnidhi, poena.
Fixes #39792.

Note: See TracTickets for help on using tickets.