我搜索了这个问题,并尝试了几种解决办法,但没有成功。
我的主要路线是:embed
我安装了‘when过滤器参数’插件,以恢复当restore移动到WordPress核心时删除的过滤器。
我试过了:page]=-1
和
我也在functions.php上试过这个
add_filter( 'rest_endpoints', function( $endpoints ){
if ( ! isset( $endpoints['/wp/v2/products'] ) ) {
return $endpoints;
}
unset( $endpoints['/wp/v2/products'][0]['args']['per_page']['maximum'] );
return $endpoints;
});参考资料:https://github.com/WP-API/WP-API/issues/2316
我已经将posts_per_page的值设置为100,-1,这并没有什么区别。我还尝试添加参数‘&post_per_page=-1,而不使用筛选器查询,这也不起作用。任何帮助或洞察力都非常感谢!
发布于 2018-10-11 08:15:15
是的,您可以一次获取比默认的10个帖子更多的信息。
只需将per_page参数添加到请求中即可。
示例:page=100
而100是当前的最大限制!
更多信息:https://developer.wordpress.org/rest-api/using-the-rest-api/pagination/
示例如何一次加载超过100个项。
使用for循环和第一个请求后的总页面数量:
https://github.com/AndreKelling/mapple/blob/master/public/js/mapple-public.js#L46
发布于 2022-06-16 06:29:56
如果per_page不起作用,请使用过滤限制
https://cnperformance.wpengine.com/wp-json/wp/v2/products/?filter[limit]=100https://stackoverflow.com/questions/50495815
复制相似问题