参考this: "E;嵌入集合响应时(…)嵌入集合将应用默认分页限制"E
如果没有为taxonomy rest路由设置这些参数,则这可能默认为10。
除此之外,您还可以过滤所有嵌入的per\\u page参数:
/** change default limit of embeds within rest requests
* @link https://github.com/WordPress/WordPress/blob/5.6-branch/wp-includes/rest-api/class-wp-rest-server.php#L1123
* @link https://developer.wordpress.org/reference/classes/wp_rest_request/get_param/
* @link https://developer.wordpress.org/reference/classes/wp_rest_request/set_param/
*/
function na_rest_embeds_set_per_page_param($response, $handler, $request) {
if($request->get_param(\'context\') === \'embed\') {
$request->set_param(\'per_page\',100);
}
}
add_filter( \'rest_request_before_callbacks\', \'na_rest_embeds_set_per_page_param\', 10, 3 );
钩住
here, 测试上下文是否为嵌入,然后将每页参数设置为100。