I embedded standard code for pagination links and everything is working fine except that clicking the Previous or Page 1 link does not take me back to the first paginated page. This is different from other problems with pagination links reported elsewhere.
The code for the pagination links is as follows:
$total_pages = $wp_query->max_num_pages;
$current_page = max(1, get_query_var('paged'));
echo paginate_links(array(
'base' => '%_%',
'format' => '?paged=%#%',
'show_all' => false,
'current' => $current_page,
'total' => $total_pages,
'end_size' => 2,
'mid_size' => 2,
'prev_next' => true,
'prev_text' => __('« Previous'),
'next_text' => __('Next »'),
'type' => 'plain',
'add_args' => false,
'add_fragment' => '',
'before_page_number' => '',
'after_page_number' => ''
));
The max number of the posts to be displayed is set to 2 and every page is showing two posts.
If you spot any potential problem with the code, please let me know.
Thank you for reading.