Skip to content

Instantly share code, notes, and snippets.

@ihorvorotnov
Created February 21, 2014 11:20
Show Gist options
  • Select an option

  • Save ihorvorotnov/9132664 to your computer and use it in GitHub Desktop.

Select an option

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);
@manshuzhang
Copy link
Copy Markdown

Work like a charm. Thank you!

@sg6
Copy link
Copy Markdown

sg6 commented Aug 26, 2016

You're a hero, thanks!

@erno14
Copy link
Copy Markdown

erno14 commented Sep 16, 2016

Perfect and simple :) thank you !!!

@jstnbr
Copy link
Copy Markdown

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