Categories

Using get_post to obtain posts information

If you know the ID of a post you can get_post to request the associated information. One thing to keep in mind is that the ID parameter MUST be a variable. get_post also takes a second parameter that allows you specify the type of output that you prefer (OBJECT, ARRAY_A for associative array, and ARRAY_N for numeric array).

<?php 
	require('wp-blog-header.php'); 
	define('WP_USE_THEMES', false);
	$post = get_post($dummy_id = 945, 'ARRAY_A');
	print_r($post);
?>

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

IMPORTANT! To be able to proceed, you need to solve the following simple math (so I know that you are a human) :-)

What is 4 + 2 ?
Please leave these two fields as-is: