开箱即用,使用核心可用挂钩和API,you can\'t have more than 100 items per response on WordPress REST API 出于性能原因。对于问题的第二部分,您可以使用_fields
您可以在examples of the handbook:
// option a: using comma separated fields names.
https://example.com/wp-json/wp/v2/posts/?_fields=author,id,excerpt,title,link
// option b: using array syntax.
https://example.com/wp-json//wp/v2/posts?_fields[]=author&_fields[]=id&_fields[]=excerpt&_fields[]=title&_fields[]=link
理论上,如果您拥有该网站,可以使用
rest_prepare_{$this->post_type}
要更改的帖子类型的动态过滤器。
if(!function_exists(\'wpse_382314_post_filter_data\')) :
function wpse_382314_post_filter_data($response, $post) {
$response->data[\'post_title\'] = \'\';
$response->data[\'post_content\'] = \'\';
}
}
add_filter(\'rest_prepare_post\', \'wpse_382314_post_filter_data\', 10, 3);