How to modify WordPress REST API response

走远了吗. 提交于 2019-12-12 03:07:59

问题


I am really really new to WordPress and I just I installed the REST API.

I am not satisfied with the default response and I want to modify it to fit the purpose I'm using it for.

I prefer the way this link modified it's response. Particularly, the "author" object details were returned in the response.

In this other blog , REST API is returning the default response. Here, "author" is an array in "_links" object. And it doesn't even contain the details of the author, just a link to it.

My question is how do I make my own plugin return the details of the author instead of the link, like the way first link did it?


回答1:


Ahmad Awais here, you linked my site and I am using the older version of the REST API Version 1 which came first, but am definitely going to move to the Version 2. You can try it out as well.



来源:https://stackoverflow.com/questions/37265427/how-to-modify-wordpress-rest-api-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!