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.

p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.

Leave a reply

Your email address will not be published.