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

Function Reference/get post status


Retrieve the post status based on the Post ID.

If the post ID is of an attachment, then the parent post status will be given instead.


<?php get_post_status$ID ?>


(int/object) (optional) Post ID or post object. This function will will return the status of the current post if $ID is not provided.
Default: ''

Return Values

Post status or false on failure.

Possible values are:

  • 'publish' - A published post or page
  • 'pending' - post is pending review
  • 'draft' - a post in draft status
  • 'auto-draft' - a newly created post, with no content
  • 'future' - a post to publish in the future
  • 'private' - not visible to users who are not logged in
  • 'inherit' - a revision. see get_children.
  • 'trash' - post is in trashbin. added with Version 2.9.


A basic example:

	if ( get_post_status ( $ID ) == 'private' ) {
		echo 'private';
	} else {
		echo 'public';


Change Log

  • Since: 2.0.0

Source File

get_post_status() is located in wp-includes/post.php.


See also index of Function Reference and index of Template Tags.