0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【WordPress】投稿タイプ情報を取得する「get_post_type_object」の結果

Last updated at Posted at 2019-03-25
archive.php
var_dump(get_post_type_object(get_post_type()));
//get_post_type() : 'post'

出力結果

object(WP_Post_Type)#4491 (29) {
  ["name"]=>
  string(4) "post"
  ["label"]=>
  string(6) "投稿"
  ["labels"]=>
  object(stdClass)#4554 (31) {
    ["name"]=>
    string(12) "投稿"
    ["singular_name"]=>
    string(12) "投稿"
    ["add_new"]=>
    string(6) "追加"
    ["add_new_item"]=>
    string(27) "投稿の新規追加"
    ["edit_item"]=>
    string(21) "投稿の編集"
    ["new_item"]=>
    string(18) "新規投稿"
    ["view_item"]=>
    string(21) "投稿を表示"
    ["view_items"]=>
    string(15) "投稿の表示"
    ["search_items"]=>
    string(21) "投稿を検索"
    ["not_found"]=>
    string(39) "記事が見つかりませんでした"
    ["not_found_in_trash"]=>
    string(51) "ゴミ箱に記事は見つかりませんでした"
    ["parent_item_colon"]=>
    NULL
    ["all_items"]=>
    string(12) "投稿一覧"
    ["archives"]=>
    string(21) "投稿アーカイブ"
    ["attributes"]=>
    string(15) "投稿の属性"
    ["insert_into_item"]=>
    string(15) "投稿に挿入"
    ["uploaded_to_this_item"]=>
    string(36) "この投稿へのアップロード"
    ["featured_image"]=>
    string(24) "アイキャッチ画像"
    ["set_featured_image"]=>
    string(33) "アイキャッチ画像を設定"
    ["remove_featured_image"]=>
    string(33) "アイキャッチ画像を削除"
    ["use_featured_image"]=>
    string(39) "アイキャッチ画像として使用"
    ["filter_items_list"]=>
    string(30) "投稿リストの絞り込み"
    ["items_list_navigation"]=>
    string(36) "投稿リストナビゲーション"
    ["items_list"]=>
    string(15) "投稿リスト"
    ["item_published"]=>
    string(30) "投稿を公開しました。"
    ["item_published_privately"]=>
    string(36) "投稿を限定公開しました。"
    ["item_reverted_to_draft"]=>
    string(39) "投稿を下書きに戻しました。"
    ["item_scheduled"]=>
    string(30) "投稿を予約しました。"
    ["item_updated"]=>
    string(30) "投稿を更新しました。"
    ["menu_name"]=>
    string(6) "投稿"
    ["name_admin_bar"]=>
    string(6) "投稿"
  }
  ["description"]=>
  string(0) ""
  ["public"]=>
  bool(true)
  ["hierarchical"]=>
  bool(false)
  ["exclude_from_search"]=>
  bool(false)
  ["publicly_queryable"]=>
  bool(true)
  ["show_ui"]=>
  bool(true)
  ["show_in_menu"]=>
  bool(true)
  ["show_in_nav_menus"]=>
  bool(true)
  ["show_in_admin_bar"]=>
  bool(true)
  ["menu_position"]=>
  int(5)
  ["menu_icon"]=>
  NULL
  ["capability_type"]=>
  string(4) "post"
  ["map_meta_cap"]=>
  bool(true)
  ["register_meta_box_cb"]=>
  NULL
  ["taxonomies"]=>
  array(0) {
  }
  ["has_archive"]=>
  string(4) "info"
  ["query_var"]=>
  bool(false)
  ["can_export"]=>
  bool(true)
  ["delete_with_user"]=>
  bool(true)
  ["_builtin"]=>
  bool(true)
  ["_edit_link"]=>
  string(16) "post.php?post=%d"
  ["cap"]=>
  object(stdClass)#4493 (15) {
    ["edit_post"]=>
    string(9) "edit_post"
    ["read_post"]=>
    string(9) "read_post"
    ["delete_post"]=>
    string(11) "delete_post"
    ["edit_posts"]=>
    string(10) "edit_posts"
    ["edit_others_posts"]=>
    string(17) "edit_others_posts"
    ["publish_posts"]=>
    string(13) "publish_posts"
    ["read_private_posts"]=>
    string(18) "read_private_posts"
    ["read"]=>
    string(4) "read"
    ["delete_posts"]=>
    string(12) "delete_posts"
    ["delete_private_posts"]=>
    string(20) "delete_private_posts"
    ["delete_published_posts"]=>
    string(22) "delete_published_posts"
    ["delete_others_posts"]=>
    string(19) "delete_others_posts"
    ["edit_private_posts"]=>
    string(18) "edit_private_posts"
    ["edit_published_posts"]=>
    string(20) "edit_published_posts"
    ["create_posts"]=>
    string(10) "edit_posts"
  }
  ["rewrite"]=>
  array(5) {
    ["slug"]=>
    string(4) "post"
    ["with_front"]=>
    bool(true)
    ["pages"]=>
    bool(true)
    ["feeds"]=>
    bool(true)
    ["ep_mask"]=>
    int(1)
  }
  ["show_in_rest"]=>
  bool(true)
  ["rest_base"]=>
  string(5) "posts"
  ["rest_controller_class"]=>
  string(24) "WP_REST_Posts_Controller"
}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?