If I call
curl -I
In terminal I get the correct response
Link: </>; rel="/"
If I call
$response = wp_remote_head( '' );
The I print_r the response. The Link: I get is
Link: ; rel="/"
Link: ; rel=shortlink
There seems to be the href stripped out of the data, but the semi-colon has been left. This is the reccomemded way from wordpress to assert if REST api is active and if pretty permalinks are selected.
What is the correct way to get the href link from the from a page header?
If I call
curl -I https://example
In terminal I get the correct response
Link: <https://example/wp-json/>; rel="https://api.w/"
If I call
$response = wp_remote_head( 'https://example' );
The I print_r the response. The Link: I get is
Link: ; rel="https://api.w/"
Link: ; rel=shortlink
There seems to be the href stripped out of the data, but the semi-colon has been left. This is the reccomemded way from wordpress to assert if REST api is active and if pretty permalinks are selected.
What is the correct way to get the href link from the from a page header?
Share Improve this question asked Dec 5, 2018 at 6:47 digitalcreative.techdigitalcreative.tech 215 bronze badges1 Answer
Reset to default 0Turns out it was there all along, but being rendered into an html tag during the output. I ended up using;
echo htmlspecialchars($response);
To get this to be displayed correctly on the page. Although I want to be checking against it in php, which I haven't go to figuring out yet, it is nice to have found it working correctly. It was displayed in the html in the element inspector which I hadn't thought to check ....whooops.