[wp-hackers] paginate_links() empty href in some cases -> bug or feature?

Ricardo Moraleida moraleida at gmail.com
Thu May 17 13:27:54 UTC 2012

On the definition of the paginate_links() in
i see that it gives $link an empty value on at least two cases:

If $current page is number 2 (lines 1954-55)

if ( $prev_next && $current && 1 < $current ) :

        $link = str_replace('%_%', 2 == $current ? '' : $format, $base);

and during the for loop, if $n == 1 (lines 1968-69)

if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current -
$mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size )
) :

                $link = str_replace('%_%', 1 == $n ? '' : $format, $base);

After that, it goes on to formatting the now empty string, adds whatever is
on the 'add_args' and 'add_fragment' inputs and  builds the array of links.

Can anyone point me the reasons for that? Should i bother dive into it to
try and make it work or is it really designed to work like this?

I've posted a complete summary of my troubles with paginate_links yesterday
still can't get around to it.

Also, i'm not a really experienced developer, so i might have misread
something on that code... but it just seems to me that paginate_links is
*this* close to working seamlessly with WP_Query, but not quite there yet.


Ricardo Moraleida

More information about the wp-hackers mailing list