Pagination adding page-numbers dots when using ‘mid_size’ => 0

Here’s a workaround:

First change the paginate_links() output type to:

'type' => 'array',

Then we can collect the previous, current and next parts from the paginate_links() output.

Here’s a simple example where we target the relevant classes:

$next="";
$current="";
$prev       = '';
foreach( (array) $paginate_links as $link )
{           
    if( false !== strpos( $link, 'prev ' ) )
        $prev = $link;
    elseif( false !== strpos( $link, ' current' ) )
        $current = $link;       
    elseif( false !== strpos( $link, 'next ' ) )
        $next = $link;
}

Finally we can construct the output as needed:

! empty( $current ) && printf(
    '<div class="pagination">%s %s %s %s %d %s</div>',
    $prev,
    esc_html__( 'Page', 'my-domain' ),
    $current,
    esc_html__( 'of', 'my-domain' ),
    $wp_query->max_num_pages,
    $next
);

Leave a Comment