This is great for showing just the raw content... Get post content from outside the loop But i'd also like to apply shortcodes from various plugins to my content to affect the content. What would I need to do to allow this?


This works...

$post_id = 956; // <<<< change page id here
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
echo $content;
|improve this answer|||||

Well, you can do this with much less code:

echo apply_filters( 'the_content', get_post_field('post_content', $post_id) );

You can also use get_post_field function to get other fields like post_title, and so on.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.