PHP code getting commented to HTML comments in WordPress

Viewed 45
<?php

use function PHPSTORM_META\type;

$api = 'api.com';
$token  = 'abcd-abcd-abcd';

$options = [
    'http' => [
        'method' => 'GET',
        'header' => "Token: $token"
    ]
];

$context = stream_context_create($options);

$resp = file_get_contents($api, false, $context);
$resp = json_decode($resp, true);
?>

The above stuff is getting commented out as HTML comments and rest as string. So can you please say how to solve this issue. I searched in online but didn't get the exact answer.

WordPress version is 5.9.4 No Plugins

<!--?php
 use function PHPSTORM_META\type;

$api = 'api.com';
$token  = 'abcd-abcd-abcd';

$options = [
    'http' =--> "['method' => 'GET','header' => "Token: $token"]];$context =stream_context_create($options);$resp = file_get_contents($api, false, $context);$resp =json_decode($resp, true);?>"
0 Answers
Related