Skip to content

Instantly share code, notes, and snippets.

@ivo-ivanov
Created September 23, 2019 06:39
Show Gist options
  • Save ivo-ivanov/4318b898e009dc457a91260e37a3b1a2 to your computer and use it in GitHub Desktop.
Save ivo-ivanov/4318b898e009dc457a91260e37a3b1a2 to your computer and use it in GitHub Desktop.
Display the post content for specific post ID outside the loop. #wordpress
// with post object by id
$post = get_post(12); // specific post ID
$the_content = apply_filters('the_content', $post->post_content);
if ( !empty($the_content) ) {
echo $the_content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment