Seems that the query string is coming from the base argument call to get_pagenum_link()
so I have removed the query string component and re-add it with ‘add_args’. Like so:
<?php echo paginate_links(array(
'base' => preg_replace('/\?.*/', "https://wordpress.stackexchange.com/", get_pagenum_link(1)) . '%_%',
'current' => max(1, get_query_var('paged')),
'format' => 'page/%#%',
'total' => $wp_query->max_num_pages,
'add_args' => array(
's' => get_query_var('s'),
'post_type' => get_query_var('post_type'),
)
)); ?>
Related Posts:
- Paginate Link generate additional #038; whenever my Url have multiple Query String
- WordPress Pagination Problem
- How to edit or override a Core function?
- Add css class to Pagination?
- Highlight the first page pagination_links
- paginate_links URL
- Paging with category page
- How to focus to a specific div when page reloads by pagination?
- Why does paginate_links() reload the entire page? and can you make it reload only a specific div?
- How to use multiple paginate_links() in my index.php?
- bones_page_navi and pre_get_posts Action
- paginate_links adds strong element
- How to break the wp_link_pages in two lines
- Changing pagination list class
- Paged posts – how to use numbers and next/previous links?
- How to remove_query_arg() for paginate_links()
- paginate_links() don’t properly work in search.php?
- Getting paginate_links() ‘end_size’ to display none
- Paginate links with “ugly” and “pretty” permalinks?
- Strange paginate_links behavior. First page link is always whatever page I’m on, all other links are correct
- How to paginate attachments in a secondary query as gallery?
- Custom Search Page Pagination Not Working
- Combining WordPress pagination functions for archives and search results
- Paginated pages are showing correct content but pagination links are not
- How to change URL structure for pagination pages?
- Search – Ajax – Alter Query Parameters with Pagination
- paginate_links() outputs extra empty pages on custom loop
- In pagination, change link for page 1 to homepage
- WP_QUERY loop, offset in the arguments and the paginate_links – can these work together?
- Custom post type archive page pagination
- Unable to get paginate_links working with a custom query [duplicate]
- 404 on term taxonomy archive pagination only with some terms
- get_the_content_feed with paginated posts
- Why category.php throw 404 in wordpress while calling paginate_links()?
- How do you paginate a query grouped by month?
- get_next_posts_link not working without parameter max_num_pages
- Duplicate posts in paginated results
- Invalid previous pagination links generated from paginate_links()
- Pretty urls for custom pagination
- Using Ajax in the prev_posts_link and next_posts_link
- paginate_links() don’t properly work in search.php?
- search with pagination not working as expected
- Pagination Not Working on `WP_Query` Archive Page
- In Custom page – next_posts_link Not working while previous_posts_link is working
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- How to properly rewrite pagination rules for a CPT to avoid 404 error on /page/2
- Include a leading zero in pagination
- Pagination Links showing incorrect previous page number
- Using Pagination for Custom Post Type and keeps returning 404
- Pagination using paginate_links
- Later blog post pages give 404 error
- Custom admin page pagination permissions error
- Paginate Links – Mid Size Less Than 2
- paginate_links() Change the order of links
- Give wp link pages it’s own template
- Pagination: Keep prev and next link even on the first/ last page
- Pagination on WP_User_Query not updating current page
- Automatically adding a link to the next page link before ” tag in posts?
- How to add pagination to category templates
- How to Edit Ecommerce filters URL, h1, h2 , Title
- Pagination not working on custom post types with rewrite slug
- How to Show Next-Previous Link Only
- Help to modify wp_link_pages()
- Archive page for WordPress Custom Post Type doesn’t show pagination from paginate_links()
- Pagination contents not changing in Front page WordPress
- How to add pagination in Terms
- Pagination not working – FrontPage
- Show number of pagination pages even when total under two
- Broken pagination links on WP 4.9.10 blog pages
- How to add post page pagination to template part?
- 404 page not found on pagination in home page while navigating to next page
- The pagination is working on Local, not on LIVE. why?
- Shortcode with pagination advancing multiple queries
- I want to create pagination for my custom post type archive that i am displaying with loop
- Paginate Links in Wp Query Shortcode
- Paginate nested query of child posts
- Extra pagination pages being wrongly generated
- Google Indexed sub pages in wordpress pagination in post
- Output wp_link_pages as raw url
- Paginate Links function: Page 1 doesn’t work
- Paginating custom posts in categories yields a 404 error
- WordPress 404 pagination (/page/2) error?
- Paginating custom query on category template
- Pagination is not working on custom query inside a custom home page template
- WordPress Pagination Not Working After Transfer from Localhost
- Add Custom Pagination Permalink
- How to change page location in WordPress
- Custom pagination [duplicate]
- Wp Pagenavi how to display all results
- Paginate Links not working
- Why is my pagination showing up?
- WordPress Pagination with ajax – Dots
- Pagination not working for archive
- wp_link_pages return value even when is condition inside if statement
- Pagination only working on index page not on a template page
- Link Back to Parent Category – Woocommerce
- Pagination Broken on Loop using ACF
- Custom template pagination
- Pagination links not working for custom taxonomy
- WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?