DEV Community

Discussion on: How to get all WordPress posts from the WP API with JavaScript

Collapse
 
elrond25 profile image
Carlos Araya

You can also get the x-wp-totalpages by making a HEAD request for the posts URL (/wp-json/wp/v2/posts/). This will return all the headers for the request and none of the content. If you need the total number of posts, there's another header you can get, x-wp-total.