WordPress Snippets at WPcustoms

Echo post content by post ID

If you need to get content from a specific page or post in your template this short code will help. Simply place it in your theme file and adjust the page\post id on top.

 * Snippet Name: Echo post content by post ID
 * Snippet URL: https://wpcustoms.net/snippets/echo-post-content-post-id/
  $my_postid = 4;//This is page id or 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;