One way is to use the offset
parameter in WP_Query
, but it overrides the paged
parameter according to the docs.
Example formula for an offset with pagination:
'posts_per_page' => $posts_per_page,
'offset' => ( $paged - 1 ) * $posts_per_page + $offset_per_page,
Example:
Then for $posts_per_page
as 4 and $offset_per_page
as 5 we get the post numbers:
first page: 6,7,8,9 (skip first 5 posts)
second page: 10,11,12,13 (skip first 9 posts)
third page: 14,15,16,17 (skip first 13 posts)
...
Notes:
In this previous answer I’ve added a way to play with another type of formula.
There might be some performance issues for really large offset numbers.
Note that WordPress also has it’s own REST API that can in many cases be used instead of Ajax.
I also wonder if the offset is really needed here, if the original loop + Ajax can be replaced with a single REST API setup instead.
ps: above is untested.