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?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745482168a4629606.html
评论列表(0条)