<div class="product-list-pagination clearfix">
<?php
$page_url = esc_url_raw(remove_query_arg( array('add-to-cart'), get_pagenum_link( 999999999, false )));
echo $page_url;
echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
'base' => str_replace( 999999999, '%#%', $page_url),
'format' => '',
'add_args' => False,
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
'prev_text' => 'previous',
'next_text' => 'next',
'type' => 'list',
'end_size' => 3,
'mid_size' => 3,
'show_all' => False,
) ) );
?>
I am having a problem with this code if the URL in browser URL bar is like this:
http://localhost/vplay/shop/page/4/?orderby=date&add-to-cart=115
after page link are added instead of removing add-to-cart=115 from URL it keeps adding both parameters to the page URL
I want my URL be something like this:
http://localhost/vplay/shop/page/4/?orderby=date
Notice when I am echoing $page_url variable the URL is fine after using it in paginate_links() function it keeps adding all parameters
now what should I do to prevent that?
Insert the above to your function.php will solve the problem. It did for me.