Get html from custom route api
I created a custom route with the wordpress API which allows me to retrieve the html content of the post
When editing a post, I added an "Export to html" link with the download attribute
echo "<a href='".get_bloginfo('url')."/wp-json/export/post/".$post->ID."' class='button-primary' download>Exporter l'article</a>";
But when I click on the link I get a .json file
How to transform this .json into .html before downloading the file?
My client will use this html export to import it into another site (not a wordpress site)