Support » Developing with WordPress » Double slash in url of custom pagination

  • I’m using the paginate_links function to generate custom pagination for a page:

    echo paginate_links(array(
    'base' => get_pagenum_link(1) . '%_%',
    'format' => '/page/%#%',
    'current' => $current_page,
    'total' => $total_pages,
    'prev_text'    => __('« Pervious'),
    'next_text'    => __('Next »'),
    'add_args'  => array()
    ));

    The problem happens when browsing the pages, an extra slash added to the URLs of paginations, so instead of https://website.com/page/1 it becomes https://website.com//page/1/. If I will remove the first slash from format 'format' => 'page/%#%', the URL will be like that: https://website.compage/1/.

    What cause the extra slash to appear?

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Double slash in url of custom pagination’ is closed to new replies.