WritingMarch 9, 20111 min read

WordPress $post Object Reference

From the archive · Originally published on the old sagalbot.com, March 9, 2011.

While working on a recent project, I needed to grab all of the attachments that match the MIME type “image/jpeg”, find the thumbnail, and wrap it in an anchor tag that links to the full size. The $post object became really useful. I figured I’d post up a reference of what properties are available through the $post object. Check it out.

stdClass Object (
[ID] => 82
[post_author] => 1
[post_date] => 2011-03-01 06:18:15
[post_date_gmt] => 2011-03-01 06:18:15
[post_content] => This is the description.
[post_title] => Equivalent of the_title();
[post_excerpt] => Equivalent o the_excerpt();
[post_status] => inherit
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] => um-hi-eeeeee
[to_ping] =>
[pinged] =>
[post_modified] => 2011-03-01 06:18:15
[post_modified_gmt] => 2011-03-01 06:18:15
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://www.example.com/wp-content/uploads/example.jpg
[menu_order] => 0
[post_type] => attachment
[post_mime_type] => image/jpeg
[comment_count] => 0
[filter] => raw
)

I won’t go through and explain everything, I mainly want to save people to trouble of running print_r($post);

Questions in the comments.

~/sagalbot49.3200° N 123.0724° W© 2026 Jeff Sagal