admin管理员组文章数量:1429562
I have a server.php
file that I wish to host on the same server as my Wordpress site, that is required to send a POST message with a header of Content-type: application/json
.
Wordpress is preventing me to use <?php header("ContentType : application/json"); ?>
and doing so, it redirects to some file on https://site/wp-json/
, which is not what I want.
Tried using the below code in the same file, but then it returns HTTP 500 Internal server error:
function changeHeaders($headers) {
$headers['Content-Type'] = 'application/json';
return $headers;
}
add_filter('wp_headers', 'changeHeaders');
How do I change the headers just for that file without the need to create a subdomain or host it on another server without Wordpress?
本文标签: Change headers for one custom PHP file
版权声明:本文标题:Change headers for one custom PHP file 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745482168a2660222.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论