从 Wordpress Rest API v2 输出中的 "curies" 中删除“_links”或大括号

Remove "_links" or remove curly brackets from "curies" in Wordpress Rest API v2 output

我已尝试使用 Unset 和 remove_links() 函数删除 API 响应中的“_links”对象,但其中 none 似乎有效,是否还有其他怎么做?

由于 URL {} 上的大括号,“居里”部分造成了麻烦,有没有办法隐藏它?

谢谢

只需使用 _fields 参数即可仅包含您想要的字段。

https://[your-host]/wp-json/wp/v2/posts?_fields=author,categories,comment_status,content,date,date_gmt,excerpt,featured_media,format,guid,id,link,meta,modified,modified_gmt,ping_status,slug,status,sticky,tags,template,title,type

来源... https://developer.wordpress.org/rest-api/reference/posts/#schema