Get Post title and content by using post ID – WordPress
May 13, 2010 by admin
1 Comment »
Here is a code snippet for getting WordPress post title and content using script. Example uses post ID.
$my_id = 7; $post_id_7 = get_post($my_id); $title = $post_id_7->post_title; $content = $title = $post_id_7->post_content;
NOTE:
You must ONLY pass the variable containing an integer value and not the actual integer. The function receives value by reference.
$post_id is an array object:
Learn more here
Posted in: Wordpress

[...] Get Post title and content by using post ID – WordPress [...]