WordPress: Get post title and post content by ID

Last updated on

To get the title for a post with ID 7:

$post_7 = get_post( 7 ); 
echo $post_7->post_title;

To get the post content for a post with ID 7:

$post_7 = get_post( 7 ); 
echo $post_7->post_content;

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

Leave a reply

Your email address will not be published. Required fields are marked *