I managed to achieve this by disabling canonical redirection for pagination queryies like so...

add_filter( 'redirect_canonical', function ( $redirect_url ) {

if ( is_paged() ) {
    return false;
}

return $redirect_url;

}, 10, 1 );

This should get you...

http://www.example.com/category_name/?paged=2

Note, this used paged instead of page as this is reserved for multi-part posts


You may use the format argument of wp_link_pages function like this:

<?php $args = array(
  'base'               => '%_%',
  'format'             => '?page=%#%',
  'total'              => 1,
  'current'            => 0,
  'show_all'           => False,
  'end_size'           => 1,
  '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'  => ''
); ?>

Its works good for me

See more https://codex.wordpress.org/Function_Reference/paginate_links

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.