How to change URL structure for pagination pages?

Hi I'm new to WordPress hence if my question was simple or stupid I'm sorry, but please someone tell me how to change URL for pagination pages.

Currently I'm having URL for pagination pages as:

www.example.com/category_name.html/1
www.example.com/category_name.html/2
www.example.com/category_name.html/3

etc.

But I need to change this URL structure as:

www.example.com/category_name.html?page=1
www.example.com/category_name.html?page=2
www.example.com/category_name.html?page=3

etc.

I tried something like this but it's not working.

add_action( 'init', 'add_author_rules' );
function add_author_rules() {
    add_rewrite_rule(
        "bycategory/108-abodes-of-vishnu)/?$",
        "category_name=$matches[1]paged=$matches[2]",
        "top");
}

Any help would be greatly appreciated.

Topic paginate-links rewrite-rules permalinks Wordpress

Category Web


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'  => ''
); ?>

<div class="pagelink"><?php echo paginate_links( $args ); ?></div>

About

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