admin管理员组文章数量:1405110
I have created this simple WordPress REST API where users can perform:
Option A
• Types in the following URL in browser:
→
www.example/wp-json/v1/getBook/123456?AuthorSurname=Buckley
The API will retrieve the relevant information and return a response in the browser:
→
{"Book":"Thank you for smoking"}
Option B
• Perform a CURL statement in CMD or via scripting:
(for Example)
function getBook($authorID, $authorSurname){
$ch = curl_init();
$url = 'www.example/wp-json/v1/getBook/123456?AuthorSurname=Buckley';
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept:application/json','Content-Type:application/json' ));
curl_setopt($ch, CURLOPT_URL, $url.$authorID.'?AuthorSurname='.$authorSurname);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute the POST request
$result = curl_exec($ch);
return $result;
curl_close($ch);
<br><br>
I would like to prevent the response from showing whenever user perform Option A.
The response can only be shown via Option B.
How can I achieve this?
本文标签: pluginsHide response returned from WordPress REST API call
版权声明:本文标题:plugins - Hide response returned from WordPress REST API call 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744882206a2630272.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论