Skip to content

Instantly share code, notes, and snippets.

@sododesign
Forked from ihorvorotnov/wp-get-content
Created December 8, 2017 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sododesign/2ee4fdd7e2eec9c7e6c1e881d07e2b89 to your computer and use it in GitHub Desktop.
Save sododesign/2ee4fdd7e2eec9c7e6c1e881d07e2b89 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment