You need the $paged
param and pass it with the ajax call.
$queryLoadPosts = new WP_Query(array(
'post_type' => 'track',
'posts_per_page' => 4,
'paged' => (isset($_REQUEST['paged']) && intval($_REQUEST['paged'])) ? $_REQUEST['paged'] : 1
));
First time you click the button the paged
param must be 2, second time 3, and so on… so you need to store somewhere the last value of paged with js, use a data-
attribute of the button can be a good idea.
see Pagination Parameters of WP_Query on Codex
Related Posts:
- WP_Query with “post_title LIKE ‘something%'”?
- WP_Query orderby date not working
- Best way to detect if you are in a SINGLE POST page
- How to do a wp_query using “BETWEEN” with two meta_values?
- Better way to get tag stats?
- Query two taxonomies via URL or link?
- How do I order pages and categories by ID or name in the same query?
- wp_query order by title
- Sort posts by custom taxonomy name
- How to adjust found_posts so that it accounts for offset and pagination
- Wp_query order by multiple custom fields?
- Would this post meta be better added to the post table rather than post_meta table
- meta_query on a date range using an array of values
- Pagination for custom query on single.php
- Get product list of given category
- Remove ellipsis from the excerpt retrieved using get_the_excerpt()
- wpdb get results doesn’t work with variable
- Query Ignoring ‘exclude’ Parameter?
- Apply CSS class to every second database record [closed]
- How to prevent writing duplicate loops?
- merge two query arguments into one WP_Query call
- Adding a parameter to the default query
- Using WP_Query in “parse_query” or “pre_get_post” in Posts2Posts
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- How do I change the order (ASC and DESC) in the following retrieval method using WP_Query?
- While creating Block Themes in WordPress, how can I query custom posts for an Archive view?
- How To Fix WP Query Returns Results But Shouldn’t?
- why update and delete query not worked in custom table?
- get_users is missing or skipping over users in loop
- Weird orderby => post__in issue
- how to handle multiple ajax wordpress queries?
- How to extract specific post
- wp_Qwery works to slow
- Search for “2nd” also returns “22nd” in wp_query
- Custom post type archive pagination query issue
- 2 weeks ago from meta query meta value
- WP Group posts by year(desc) > month(desc) > date(asc)
- Running main loop 2 times with conditional statement
- paged variable not working for category/custom post archive
- How to output the title of the blogs home page
- Array as ‘key’ in WP_Query
- Reset WordPress Post Query to default
- Check the Specific Meta Key IF its Meta Value is Empty then… (WP Post Meta Query)
- Woocommerce – exclude only older out-of-stock items
- Searching for meta_key returns 0 posts
- Using custom taxonomies in a query
- ACF accessing a field from the query, but not in post
- Determining Author post count
- How I can change the condition or compare operator for WP_Query in pre_get_posts
- Is there a ‘compare’ option when using WP_Query apart from meta_query
- Apply filters to main query instead of creating new one?
- WP_Query returns different results from get_posts() [closed]
- How to pass query string vars between admin pages?
- Query posts by Post title
- WP_User_Query and user posts
- Why do I have to use pre_get_posts with custom WP_Query to reset posts_per_page?
- WP order ASC in custom author loop
- Query to get last posts from authors of blog
- Custom Homepage Pagination using WP_Query
- My website is getting too many dierect home arechives and this is increasing my bounce rate
- How to get latest post excerpt from a specific category?
- Get all content on a “single page” site depending on language
- Get list of all Grandchild Pages
- get latest added term from taxonomy and insert into php variable
- Featured images loop for Orbit Slider
- Trouble passing attribute into shortcode function
- WP_Query return posts in wrong order
- Exclude post with taxonomy and from the terms (taxonomy & tag) posts count
- WordPress search WP_Query to cover multiple post types and their custom fields?
- How do i create a custom post query when the meta value is an array?
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Pagination on archive.php not working?
- How to use jQuery validation to set the search bar to accept only a specific input?
- How to filter on placeholder image
- How to compare between two dates in a nested loop?
- How to query 5 users in random who have published more than 10 posts
- Limit default Search query to post_title
- Order & Orderby clause not working with custom query
- WP_Query doesn’t works inside loop
- How to redirect a query string to a “virtual” subdirectory
- WP_Query returns images but post_per_page is incorrect
- Problem with custom WP_Query and underlying pagination/posts_per_page
- WP_Query with child element
- Select posts wich has no relationship in custom taxonomy
- WordPress Query posts that have title > another title
- Custom query to order by multiple taxonomies
- Custom post type archive organized by category
- Adding page subdirectory dynamically, as like buddypress does
- Read more redirection problem
- Creating Custom Query
- Help in query for list links
- Multiple loops on index page with sticky post and pagination
- WP_Query issues with argument posts_per_page
- Search (Custom Form, Custom Search Result)
- Randomly display posts on a site hosted by WPEngine? [closed]
- tax_query not working properly with get_posts
- Elementor custom query
- Get access to all terms associated to each post that the wp_query loop displays
- Sort by multiple columns using get_posts
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)