Skip to content

Instantly share code, notes, and snippets.

@ihorvorotnov
Created February 21, 2014 11:20
Show Gist options
  • Save ihorvorotnov/9132664 to your computer and use it in GitHub Desktop.
Save ihorvorotnov/9132664 to your computer and use it in GitHub Desktop.
WordPress: get post content by ID
/**
* You often need to get the content or title from a specific post.
* Sometimes, using a custom loop is the better option, but when you only need
* to get information from a specific post, there’s a better option
*/
echo get_post_field('post_content', $post_id);
@sg6
Copy link

sg6 commented Aug 26, 2016

You're a hero, thanks!

@erno14
Copy link

erno14 commented Sep 16, 2016

Perfect and simple :) thank you !!!

@jstnbr
Copy link

jstnbr commented Feb 23, 2018

Perfect solution. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment