-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Thank you for this helpful library, the only one for accessing the WP REST API with PHP – as far as I can see!
Now, my goal is to load every available post from the REST API to display them in a frontend.
As of the current WordPress version, we can only get 100 posts per request from the API.
$client->posts()->get(
null,
array(
'per_page' => 100,
)
);Fortunately, there is a header X-WP-TotalPages, where I can see how many requests I would need to fire to get all available posts. (see https://wordpress.stackexchange.com/questions/217490/get-post-count-in-wp-rest-api-v2-and-get-all-categories/250589#250589).
However, I don't see a way to get this header from the $client instance. Is there a way that I don't see?
Right now I do requests, until there are no posts in the response anymore. This leads to one request that I could save.