[wp-trac] [WordPress Trac] #44513: bug in paginate_links function

WordPress Trac noreply at wordpress.org
Tue Dec 22 21:21:20 UTC 2020


#44513: bug in paginate_links function
--------------------------+------------------------------
 Reporter:  luca74        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.9.6
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Description changed by sabernhardt:

Old description:

> Hi,
> 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
> FROM:
> $link = str_replace( '%_%', 2 == $current ? '' : $args['format'],
> $args['base'] );
>
> TO:
> $link = str_replace( '%_%', 1 == $current ? '' : $args['format'],
> $args['base'] );
>
> LINE 3792
> FROM:
> $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base']
> );
>
> TO:
> $link = str_replace( '%_%', 0 == $n ? '' : $args['format'], $args['base']
> );

New description:

 Hi,
 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
 FROM:
 `$link = str_replace( '%_%', 2 == $current ? '' : $args['format'],
 $args['base'] );`

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

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

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

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44513#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list