Get a WordPress Post by ID and Display its Body

In some instances you might want to get the content from a specific post and display it on one of your pages. Here’s how it can be done with a little PHP.

$my_postid = 12; //define post id
$content_post = get_post($my_postid);
$content = $content_post->post_content; $content = apply_filters(‘the_content’, $content); $content = str_replace(’]]>’, ‘]]>’, $content);
echo $content;

If you found this useful please consider a small donation: