WordPress custom URLs for pagination pages

I’m trying to find a way to make custom URLs for each pagination page separated by <!--nextpage--> tag. For example, if the first page is:

myblog.com/my-topic/

the second one will be:

myblog.com/my-topic/2/

Is it possible to customize this link? I want it to be:

myblog.com/my-topic/something/

or if it is necessary to contain number it can also be:

myblog.com/my-topic/page-2-something/

or

myblog.com/my-topic/2-something/

I was searching through a lot of plugins, but it seems none of them provide this option. It would be very useful for SEO, don’t you think? Each page URL would contain some specific keyword related to its content. I guess the best approach would be to add a parameter to <!--nextpage--> tag, containing a specific word.

Is there some plugin or known hack for making this possible? I’m using the latest WP 4.7.3

1 Answer
1

Check the ‘format’ argument

<?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>

Leave a Comment