I tried using
<?php
$my_id = 7;
$post_id_7 = get_post($my_id);
echo $post_id_7->post_content;
?>
based on the documentation here.
The article I’m trying to retrieve has Short Code, which is picked up by a plugin on my site, and then formatted into HTML.
The problem is when I output the post_content to the site, the short code isn’t picked up by the plugin, and I effectively just write out the short code straight to the browser.
Is there a way to get the short code evaluated properly? Or am I using the wrong function?
Post’s object field contains raw content as it is stored in database. This should format it to how it appears when retrieved with template tags:
This filters runs number of formatting functions, including shortcodes parsing. Something close to this: