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
- Get a list of posts by specific category
- Pagination works in custom query loop but it doesn’t work in shortcode
- WordPress Custom Search Form Displaying Unexpected Results
- “paged” in WP_Query returns 0 posts
- Search Page Returns Nothing
- Use Ajax To filter posts?
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Pagination on template page for custom query redirecting to index.php
- Select2 AJAX and WP Query Returns ALL and does not filter
- Redirect Search to Form When No Product Results Are Found
- How to properly use AND / OR in custom search
- Change AJAX filter from POST to GET for URL Parameters
- How to avoid bypass of search bar rules?
- Yoast primary category query modification
- Hide products in uncategorized category from search results
- Loading two different AJAX requests on two different pages
- AJAX Breaking Offset Argument In WP Query
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- Apply filters to main query instead of creating new one?
- Issues with search after added meta_query
- How do you determine if a result in a search query is a post or a page?
- Slow Query On Search
- Page navigation doesn’t seem to work when I add offset?
- WP_Query offset is returning post from prevois loop
- Sorting search results with custom dropdown
- How To Keep Search Title the same on paged Results
- wp_query show all values
- change posts_orderby of the callback wp_query?
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- How to use a dropdown to filter posts by custom field
- Does WP_Query ‘responds’ badly to empty arguments?
- Notice thrown when creating numeric pagination on custom query
- Retrieve data from wordpress db via input and put those result in dropdown
- Pagination in html table is not working
- Content not displaying on paginated page
- Paging + WP Query
- How to restrict search on a certain page to only return results against custom taxonomies?
- Pagination with Custom Post Type not working on index.php: I get a 404
- Pagination on custom post type not working
- Filtering product search results using tags
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Refresh wp_query with no changes
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- How does Show Posts based on a keyword search work in WP_Query
- Pagenavi with archive page
- Show number of posts AND number on current page (cannot make it work)
- WordPress WP_User_Query ignores the `meta_query` when called from an Ajax function
- Search query alteration not working for meta values
- AJAX search function resets wp_query vars
- Limit paginated result set to a maximum number of posts
- WordPress Ajax search filter on dropdown select
- Custom Taxonomy in custom REST API search
- 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
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Pagination URL not good
- Removing filename searches when searching attachments
- Modify WordPress Search
- Rewrite URL custom search query
- Multiple queries and pagination
- Applying a custom query for the AJAX “us_ajax_grid” function (from WPBakery)
- Optimizing AJAX Query with Large Database
- Paginate_Links page 2 doesn’t work
- WP_query with ajax filter not working with input fields
- WP_Query offset returning duplicate posts from previous loops with AJAX