Make WordPress Core

Opened 3 years ago

Closed 11 days ago

#44513 closed defect (bug) (invalid)

bug in paginate_links function

Reported by: luca74 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: General Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

I've used the paginate_links function, but I find a bug, and solve it.
if you are in page 2, and you want to go at page 1 (clicking on the number) or on previous text, the pagination not works: it's missing the ?page=1
So I take a look on the script and I've change:

File: includes/general-template.php

Line 3771
$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );

$link = str_replace( '%_%', 1 == $current ? '' : $args['format'], $args['base'] );

LINE 3792
$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );

$link = str_replace( '%_%', 0 == $n ? '' : $args['format'], $args['base'] );

Change History (3)

#1 @sabernhardt
4 weeks ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.

11 days ago

#3 @peterwilsoncc
11 days ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version changed from 4.9.6 to 2.1

@luca74 Hello and welcome to trac!

This ticket was discussed in a triage session today.

paginate_links() is designed to assume that page one is the default, this is to allow the paging URLs to follow the form wordpress.org/my-post/2/ with the first page been wordpress.org/my-post

I'm going to close this ticket of as invalid, which in this case is trac's unfriendly term to mean the function is working as intended.


Note: See TracTickets for help on using tickets.