I think this is what you want. base is set via home_url(), format is page/%#%/, search query arg is added via add_args if it exists:
$args = array(
'base' => home_url( '/%_%' ),
'format' => 'page/%#%/',
'current' => max( 1, get_query_var('paged') ),
'total' => $temp->max_num_pages,
);
if( isset($_GET['s']) ){
$args['add_args'] = array(
's' => $_GET['s'] // your search query passed via your ajax function
);
}
echo paginate_links( $args );
Related Posts:
- How to filter a static post page with ajax and $wp_query
- Post_count only shows the number of results per page
- How to paginate attachments in a secondary query as gallery?
- next_posts_link not working for loop called with ajax
- Pagination not working for Custom search form & custom result template
- Pagination broken when merging search results with additional WP_Query
- Paginated pages are showing correct content but pagination links are not
- Pagination wont work with search results template [duplicate]
- Add custom search results to main WP search [duplicate]
- WP_QUERY loop, offset in the arguments and the paginate_links – can these work together?
- WP_Query ajax loader detect end of posts
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- paging in WP_Query on static page
- wp_query ‘s’, search filter with pagination is not working
- how to handle multiple ajax wordpress queries?
- WordPress pagination not working on template search.php
- Cutom wp_query for geolocation search, pagination not working
- Pretty urls for custom pagination
- How do I get my custom query to work with search results after the first page?
- Ajax (jquery) wp_query pagination returns -1
- Pagination repeating posts on search results
- Filter admin ajax data by url query
- paginate_links method doesn’t show second page of my custom wp_query
- WordPress search page pagination displaying but not functional
- Order & Orderby clause not working with custom query
- Paginate nested query of child posts
- WordPress WP_Query offset parameter not working with search parameter
- Pagination is not working on custom query inside a custom home page template
- Duplicate posts showing up in loop using infinite scroll
- error with $query->have_posts()
- Search results stuck on page 1
- Pagination only showed when no category is set in wp_query
- AJAX multiple search boxes not merging with array merge
- Multiple WP_Query with pagination shows Page/2 content on the remaining pages
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- WP_Query and Pagination on a Static front page
- Pagination/infinite scroll with WP_Query and multiple loops
- WP_query and pagination?
- pagenavi with merged wp_query [duplicate]
- Custom search form with empty parameters
- Ajax Infinite Scroll In Custom WP_Query Loop Not Working
- Transient pagination not working properly
- Woocommerce custom loop to show all the products [closed]
- Pagination 404 errors for author posts query on author.php
- Pagination problem after WP_Query with tag filtering
- Pagination stops at page 6
- Paginated HTML Sitemap
- WP Query search for attachments and their exact title
- Pagination is broken and I need help fixing it
- Creating a custom search for a specific post type
- Can’t search posts using WP_QUERY inside AJAX Function
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- Search for multiple tags?
- pagination with numbers for WP_User_Query
- posts_per_page not working for first page of pagination
- Query with search and subscribers only output
- Pagination on static Posts page
- Filter wordpress post categories with jquery/ajax and pagination?
- Modify Search Query if original Query gave no results
- How to cache wp_query with pagination using transients?
- Include post content of linked posts in search
- How do I amend wp_query before it is run/executed?
- Use Ajax To filter posts?
- Pagination on template page for custom query redirecting to index.php
- How to properly use AND / OR in custom search
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- Paging + WP Query
- How to restrict search on a certain page to only return results against custom taxonomies?
- WP_Query custom order and pagination
- ajax wp_query conditional tags not working
- Unable to paginate a custom page query
- Query Not working as expected
- max_num_pages says 4, yet I am only able to navigate to the third page
- Paginate pages with dynamic query
- Trouble Making WP_Query paged
- My combination of ‘post_type’ and ‘tax_query’ not working?
- paginate_links appearing on page but it doesn’t actually paginate – pagination on a static page with a dynamic `post_type` argument on a static page
- WordPress live search and filter
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- Pagination Shows Up But Won’t Work on Custom Gallery Page
- Search has query that will return no results
- remove_action – pre_get_posts – does not restore original query
- WP Query – Search in title or author_name
- Pagination returns 404 after page 20
- I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views
- Why is $wp_query fetching nothing?
- Horizontally paginate through sets of blog posts?
- Pagination error WordPress multiple loop
- Comments orderby comment date not working
- Switched from query_posts to wp_query, pagination no longer working
- Pagination With Custom WP Query not functioning
- Ordering Custom WP_Query loop by meta key value with pagination
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- paginate_links() on page (shortcode output)
- WordPress Post Looping? [duplicate]
- WordPress WP_User_Query ignores the `meta_query` when called from an Ajax function
- Limit paginated result set to a maximum number of posts
- Extend search query to search meta keys values based on search string
- Modify WordPress Search