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
- ajax category filter
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- Ajax and WP_Query/tax_query parameter
- Pagination Not working on Home Page with 2 Query
- ‘posts_where’ filter not applying ‘WP_Query’ in `wp_ajax`
- Best Practice For Querying Grandchildren?
- Show single post then all posts (with pagination)
- tax_query shows no results if nothing is selected
- WP_Query orderby breaks when using AJAX?
- Refine/Filter WP_Query Posts with jQuery or Ajax
- Unable to get paginate_links working with a custom query [duplicate]
- Search Posts with Custom Fields as query
- Storing query variable and then using wp_reset_query
- Ajax Pagination on Ajax filter
- Wp_query returning only one post while query through ajax
- WordPress Pagination changes my template
- Custom Pagination Layout for Elementor widget
- Pagination outside of loop
- query_vars overriding WP_Query args
- Custom Pagination in Shortcode with WP_Query
- Avoid repeated post on page 2 when excluding one on page 1
- How to make search for posts using get method?
- paginate_links() don’t properly work in search.php?
- Pagination for blog posts reloading same page [closed]
- Search posts missing a particular custom field
- Replacing search results with custom external query
- Get a list of posts by specific category
- Page navigation doesn’t seem to work when I add offset?
- Sorting search results with custom dropdown
- I am officially missing something about transient posts
- Change post query onclick
- WP_Query Pagination
- Searching not only by post name but also category
- WP_Query, Paginate by Custom Field
- Block internal search queries with pre_get_posts and regex rules
- duplicated posts when using pagination
- Using Ajax and WP_Query to load more posts on category page fails
- How to make the WP query search for the “s” arg in other places too
- Search Exact on WordPress – Relevannsi Solution Not Working
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- I have problems with the search query using multiple post types
- WP_query pagination on frontpage
- Display Search Results by tag_ID in my search.php
- 404 page on custom search pagination
- Paging works correctly on local version, but not live?
- Logging search queries for logged-in users
- Pagination not working in custom loop WP_Query
- Search Field that allows options of “Match any keyword” or “Match all keywords”
- A very strange problem with search query
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- previous_posts_link not working in WordPress pagination
- Pagination not working with WP_QUERY
- WP_Query with meta_value_num and meta_query not paged correctly
- Search Query that Includes Custom Table
- Pagination with WP_Query not working
- wp_query pagination links producing 404
- How return normal search result using wp_ajax action for wordpress
- Why won’t my paged wp_query work? [duplicate]
- WP_Query breaks pagination
- paginate_links() with Custom Taxonomy
- Pagination problem with multiple loops on the same page
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- Show number of posts AND number on current page (cannot make it work)
- Search query alteration not working for meta values
- Advanced Search – Is this possible?
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string