蛸メモ

PHP、Wordpressなどなど。勉強したことを全部、まとまってなくても気にせずどんどん書くメモ。

【Wordpress関数】get_post_type()

get_post_type()

投稿タイプ(post、page、attachment、revision、nav-menu、作成したカスタム投稿タイプなど)を取得する。

構文

get_post_type( $post )

引数 必須 初期値 説明
$post false 投稿タイプを取得したい投稿のID。初期値では現在のクエリの投稿。
戻り値

投稿タイプ名。取得できなかった場合はfalse。

Author
id:web_octopus web_octopus

web無職