I'm paginating a custom post type on a custom page. The content of the page is determined by a custom query, like this:
When I change
sect= to something else the page changes accordingly.
Now on the orders page I wanted to add pagination, and I added it with this code:
echo paginate_links( array( 'base' => get_pagenum_link(1) . '%_%', 'format' => '&paged=%#%', 'total' => $total_pages, 'current' => $page_number, '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' => '' ) );
What I want to achieve is that
paged=PAGENUMBER is added as a query parameter, so
Everything works and the generated pagination links are pointing to the url structure I want, but then when the link is clicked I get a 301 redirect to
mysite.com/my-account/page/2/?sect=orders. The pagination works, I get the second page... but that url is very ugly.
How I can change the pagination URL structure only on this
my-account page? I want to be a normal
&paged=2 query parameter along other parameters.