get_post_status

Sponsored Link

投稿IDに基づいて投稿ステータスを取得します。

投稿IDが添付ファイルである場合は、親の投稿ステータスが代わりに与えられます。

Sponsored Link

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.

get_post_statusのファンクションタグ使用方法

<?php get_post_status( $ID ) ?>

get_post_statusのパラメーター

$ID

(integer) (optional) 投稿ID。この関数は、$IDが提供されていない場合、falseを返します。
Default: ”

(integer) (optional) Post ID. This function will will return false if $ID is not provided.
Default: ”

戻り値

(string|boolean) 投稿の状態または失敗した場合にFALSEを返します。
可能な値は次のとおりです。

  • ‘publish’ – 公開された投稿やページ
  • ‘pending’ – 投稿が、レビューを保留されている。
  • ‘draft’ – 下書き状態の投稿
  • ‘auto-draft’ – 内容がない、新しく作成された投稿。
  • ‘future’ – 将来的に公開する投稿。
  • ‘private’ – ログインしていないユーザーには表示しません。
  • ‘inherit’ – リビジョン。 get_childrenを参照してください。
  • ‘trash’ – 投稿がゴミ箱。バージョン2.9で追加されました。

(string|boolean)
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.

変更ログ

Since: 2.0.0

ソースファイル

get_post_status()は、wp-includes/post.php内に位置しています。

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

Sponsored Link