WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/$post

$post

Contains data from the current post in The Loop.

Properties

ID
(integer) The post ID.
post_author
(integer) The ID of the post author.
post_date
(string) The post date using the server's current timezone. Format: yyyy-mm-dd hh:mm:ss Example: 2011-05-19 13:51:21
post_date_gmt
(string) Same as above, but in GMT.
post_content
(string) The post content.
post_title
(string) The post's title.
post_excerpt
(string) The post's excerpt, if one is set.
post_status
(string) See get_post_status for possible values.
comment_status
(string) See wp_get_comment_status for possible values.
ping_status
(string) Values: 'open' or 'closed'.
post_password
(string) The post's password.
post_name
(string) The post's slug.
to_ping
(string) Addresses to be pinged.
pinged
(string) Addresses already pinged.
post_modified
(string) Date the post was last modified using server's timezone.
post_modified_gmt
(string) Same as above in GMT.
post_content_filtered
post_parent
(integer) ID of the post's parent, if it has one.
guid
(string) A link to the post. This is not the permalink. To get the permalink use get_permalink.
menu_order
(integer) The value set in the 'Order' field for pages.
post_type
(string) The post type.
post_mime_type
(string) Mime Type (for attachments, etc).
comment_count
(integer) The number of approved comments.
ancestors
(array) An array of the post's ancestors' IDs (parent, parent's parent, etc). [0] = parent, [1] = grandparent, etc.
filter
(string)

Usage

<?php
global $post;
echo $post->post_title;
?>