我对Wordpress和JSON API有点陌生,所以如果这是一个新手问题,请原谅,但我正在尝试获取一些不同自定义帖子类型的所有帖子,并通过我自己的JSON控制器(扩展JSON API)将它们作为JSON返回
如果我这样做:
$posts = $json_api->introspector->get_posts(array(\'post_type\' => array(\'post\',\'tweet\',\'gallery\',\'video\',\'music\'), \'post_parent\' => 0, \'order\' => \'ASC\', \'orderby\' => \'date\', \'numberposts\' => 100000000000));
echo count($posts);
我只得到“10”个帖子,但在db中还有很多。鉴于如果我这样做:echo count(get_posts(array(\'post_type\' => array(\'post\',\'tweet\',\'gallery\',\'video\',\'music\'), \'post_parent\' => 0, \'order\' => \'ASC\', \'orderby\' => \'date\', \'numberposts\' => 100000000000)));
我得到了“74”,这是db中正确的帖子数量。本质上,JSON API将返回值限制为仅10个POST。我很确定我可以破解JSON API插件以允许更多,但这似乎会打乱我的API升级代码。有没有办法将JSONAPI->内省者帖子编号设置为“all”
谢谢
[Mods:我在一分钟前交叉发布了这个堆栈溢出问题,但不确定哪个网站发布这个问题更好,请让我知道,我会酌情删除]