用于/ posts的Wordpress REST API不返回分页标题

时间:2018-12-04 11:56:31

标签: wordpress rest

我正在尝试从WP REST Api获得分页。

我尝试致电http://my_base_url/wp-json/wp/v2/posts

并且正如文档建议(https://developer.wordpress.org/rest-api/using-the-rest-api/pagination/#pagination-parameters)那样,该调用应返回两个标头:X-WP-TotalX-Wp-Totalpages

当我尝试使用?page=1?per_page=3之类的分页参数发出请求时,这些标头将不会返回。

这些是我收到的标头:( POSTMAN中的请求) allow →GET cache-control →no-cache, must-revalidate, max-age=0 connection →Keep-Alive content-type →application/json; charset=UTF-8 date →Tue, 04 Dec 2018 11:16:44 GMT expires →Wed, 11 Jan 1984 05:00:00 GMT keep-alive →timeout=2, max=100 link →<http://my_base_url/wp-json/wp/v2/posts?per_page=3&page=2>; rel="next" server →Apache transfer-encoding →chunked vary →Cookie x-powered-by →PHP/7.0.12

0 个答案:

没有答案