I'm trying to make a php script which, given a post id, returns post content. I'm not the one who writes articles, I'm just operating on a wp site. Post content is for an app of mine which has to parse it.
My script is very simple:
<?php
require_once("wp-load.php");
if(isset($_GET['id'])){
$post_id = $_GET['id'];
$queried_post = get_post($post_id);
echo $queried_post->post_content;
}
?>
Result is the article but sometimes the image is embedded in a [caption] field, like this:
[caption id="attachment_78971" align="alignnone" width="276"]<a href="href" rel="attachment wp-att-78971"><img class="size-medium wp-image-78971"/></a>[/caption]
other times I have just the image
<img ...ecc
why is that? Is there a way to force the same output regardless of who has written the article?