{"id":5361,"date":"2023-09-09T11:51:04","date_gmt":"2023-09-09T02:51:04","guid":{"rendered":"https:\/\/wpmake.jp\/contents\/?post_type=customize&#038;p=5361"},"modified":"2024-06-27T18:59:09","modified_gmt":"2024-06-27T09:59:09","slug":"show-in-menu-submenu","status":"publish","type":"customize","link":"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/","title":{"rendered":"\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092add_menu_page\u3067\u8ffd\u52a0\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u6b21<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #282828;color:#282828\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #282828;color:#282828\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB\" >\u306f\u3058\u3081\u306b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E6%8A%95%E7%A8%BF%E3%81%A8%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E4%BD%9C%E6%88%90\" >\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3068\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc\u306e\u4f5c\u6210<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E6%8A%95%E7%A8%BF%E3%82%BF%E3%82%A4%E3%83%97%E3%82%92_register_post_type_%E3%81%A7%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B%E3%80%82\" >\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092 register_post_type \u3067\u4f5c\u6210\u3059\u308b\u3002<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%82%92_add_menu_page_%E3%81%A7%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B%E3%80%82_3_4\" >\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc\u3092 add_menu_page \u3067\u4f5c\u6210\u3059\u308b\u3002 3 4<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E6%8A%95%E7%A8%BF%E3%82%92%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B\" >\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3092\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3059\u308b<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%83%87%E3%83%95%E3%82%A9%E3%83%AB%E3%83%88%E3%81%AE%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88\" >\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u5834\u5408<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#add_menu_page_%E3%81%A7%E4%BD%9C%E6%88%90%E3%81%97%E3%81%9F%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88\" >add_menu_page \u3067\u4f5c\u6210\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u5834\u5408<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%81%AA%E3%81%9C%E5%80%A4%E3%81%AE%E6%9B%B8%E3%81%8D%E6%96%B9%E3%81%8C%E7%95%B0%E3%81%AA%E3%82%8B%E3%81%AE%E3%81%8B%EF%BC%9F\" >\u306a\u305c\u5024\u306e\u66f8\u304d\u65b9\u304c\u7570\u306a\u308b\u306e\u304b\uff1f<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#_add_post_type_submenus\" >_add_post_type_submenus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#add_submenu_page_5\" >add_submenu_page 5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#add_menu_page\" >add_menu_page<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E7%99%BB%E9%8C%B2\" >\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u306e\u767b\u9332<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#menuphp\" >menu.php<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E3%81%BE%E3%81%A8%E3%82%81\" >\u307e\u3068\u3081<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#%E5%8F%82%E8%80%83%E8%A8%98%E4%BA%8B\" >\u53c2\u8003\u8a18\u4e8b<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/wpmake.jp\/contents\/customize\/show-in-menu-submenu\/#Footnotes\" >Footnotes<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB\"><\/span>\u306f\u3058\u3081\u306b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u3053\u306e\u8a18\u4e8b\u3092\u66f8\u304f\u304d\u3063\u304b\u3051\u3068\u306a\u3063\u305f\u306e\u306f\u3001WordPress \u3067\u8907\u6570\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u4f5c\u6210\u3057\u305f\u969b\u30011 \u3064\u306e\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u307e\u3068\u3081\u308b\u305f\u3081\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u306b\u8868\u793a\u3059\u308b\u624b\u6bb5\u3092\u8abf\u3079\u305f\u3053\u3068\u3067\u3059\u3002<br \/>\n\u305d\u306e\u969b\u3001\u6295\u7a3f\u3084\u56fa\u5b9a\u30da\u30fc\u30b8\u3068\u3044\u3063\u305f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u5834\u5408\u3068\u3001add_menu_page \u3067\u4f5c\u6210\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u5834\u5408\u3067\u3001\u5024\u306e\u66f8\u304d\u65b9\u304c\u5c11\u3057\u7570\u306a\u308b\u3053\u3068\u3092\u77e5\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u305d\u306e\u66f8\u304d\u65b9\u3068\u3001\u5024\u304c\u7570\u306a\u308b\u7406\u7531\u306b\u3064\u3044\u3066\u3092\u66f8\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E6%8A%95%E7%A8%BF%E3%81%A8%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E4%BD%9C%E6%88%90\"><\/span>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3068\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc\u306e\u4f5c\u6210<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E6%8A%95%E7%A8%BF%E3%82%BF%E3%82%A4%E3%83%97%E3%82%92_register_post_type_%E3%81%A7%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B%E3%80%82\"><\/span>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092 register_post_type \u3067\u4f5c\u6210\u3059\u308b\u3002<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre>\r\nfunction create_custom_post() {\r\n  $labels = array(\r\n    'name' => 'Article',\r\n    'menu_name' => 'Article',\r\n  );\r\n  $args = array(\r\n    'labels' => $labels,\r\n    'public' => true,\r\n    'show_ui' => true,\r\n    'show_in_nav_menus' => true,\r\n    'show_in_menu' => true,\r\n    'show_in_admin_bar' => true,\r\n    'menu_icon' => 'dashicons-media-code',\r\n  );\r\nregister_post_type('article', $args);\r\n}\r\nadd_action('init', create_custom_post(...));\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%82%92_add_menu_page_%E3%81%A7%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B%E3%80%82_3_4\"><\/span>\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc\u3092 add_menu_page \u3067\u4f5c\u6210\u3059\u308b\u3002 <sup><a href=\"#user-content-fn-%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9\/add_menu_page-5818dbe52e1d5b1c3661955943a04c19\" id=\"user-content-fnref-%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9\/add_menu_page-5818dbe52e1d5b1c3661955943a04c19\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">3<\/a><\/sup> <sup><a href=\"#user-content-fn-add_menu_page-5818dbe52e1d5b1c3661955943a04c19\" id=\"user-content-fnref-add_menu_page-5818dbe52e1d5b1c3661955943a04c19\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">4<\/a><\/sup><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre>\r\nfunction add_custom_menu() {\r\n  add_menu_page(\r\n    '\u6295\u7a3f\u30bf\u30a4\u30d7\u4e00\u89a7\u753b\u9762',\r\n    '\u3059\u3079\u3066\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f',\r\n    'manage_options',\r\n    'all_post',\r\n    'create_custom_menu_content',\r\n    'dashicons-menu-alt3',\r\n    3\r\n  );\r\n};\r\nfunction create_custom_menu_content() {\r\n  include(__DIR__.'\/inc\/CustomMenuContent.php');\r\n};\r\nadd_action('admin_menu',add_custom_menu(...), 9);\r\n<\/pre>\n<p>\u305d\u3046\u3059\u308b\u3068\u3001\u30e1\u30cb\u30e5\u30fc\u30d0\u30fc\u306f\u3053\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-1.png\" alt=\"article-picture-1\" width=\"1455\" height=\"565\" class=\"aligncenter size-full wp-image-5364\" srcset=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-1.png 1455w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-1-300x116.png 300w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-1-1024x398.png 1024w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-1-768x298.png 768w\" sizes=\"auto, (max-width: 1455px) 100vw, 1455px\" \/><\/p>\n<p>\u3053\u308c\u3067\u524d\u63d0\u3068\u306a\u308b\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3068\u30e1\u30a4\u30f3\u30e1\u30cb\u30e5\u30fc\u304c\u4f5c\u6210\u51fa\u6765\u307e\u3057\u305f\u3002<br \/>\n\u7d9a\u3044\u3066\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E6%8A%95%E7%A8%BF%E3%82%92%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B\"><\/span>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3092\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3059\u308b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E3%83%87%E3%83%95%E3%82%A9%E3%83%AB%E3%83%88%E3%81%AE%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88\"><\/span>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u5834\u5408<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u307e\u305a\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u6295\u7a3f\u30da\u30fc\u30b8\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre>\r\nfunction create_custom_post() {\r\n  $labels = array(\r\n    'name' => 'Article',\r\n    'menu_name' => 'Article',\r\n  );\r\n  $args = array(\r\n    'labels' => $labels,\r\n    'public' => true,\r\n    'show_ui' => true,\r\n    'show_in_nav_menus' => true,\r\n    'show_in_menu' => 'edit.php',\r\n    'show_in_admin_bar' => true,\r\n    'menu_icon' => 'dashicons-media-code',\r\n  );\r\nregister_post_type( 'article' , $args );\r\n}\r\nadd_action('init', 'create_custom_post');\r\n<\/pre>\n<p>show_in_menu \u306e\u5024\u3092 edit.php \u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002edit.php \u306f\u6295\u7a3f\u30da\u30fc\u30b8\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u3059\u3002<br \/>\n\u3059\u308b\u3068\u3001\u6295\u7a3f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-2.png\" alt=\"article-picture-2\" width=\"1360\" height=\"649\" class=\"aligncenter size-full wp-image-5366\" srcset=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-2.png 1360w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-2-300x143.png 300w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-2-1024x489.png 1024w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-2-768x366.png 768w\" sizes=\"auto, (max-width: 1360px) 100vw, 1360px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"add_menu_page_%E3%81%A7%E4%BD%9C%E6%88%90%E3%81%97%E3%81%9F%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%A8%E3%81%97%E3%81%A6%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88\"><\/span>add_menu_page \u3067\u4f5c\u6210\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u5834\u5408<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u6b21\u306b\u3001\u5148\u307b\u3069\u4f5c\u6210\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre>\r\nfunction create_custom_post() {\r\n  $labels = array(\r\n    'name' => 'Article',\r\n    'menu_name' => 'Article',\r\n  );\r\n  $args = array(\r\n    'labels' => $labels,\r\n    'public' => true,\r\n    'show_ui' => true,\r\n    'show_in_nav_menus' => true,\r\n    'show_in_menu' => 'all_post',\r\n    'show_in_admin_bar' => true,\r\n    'menu_icon' => 'dashicons-media-code',\r\n  );\r\nregister_post_type( 'article' , $args );\r\n}\r\nadd_action('init', 'create_custom_post');\r\n<\/pre>\n<p>show_in_menu \u306e\u5024\u3092\u5909\u66f4\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3068\u540c\u3058\u3088\u3046\u306b\u66f8\u304f\u306e\u3067\u3042\u308c\u3070\u3001\u6295\u7a3f\u30da\u30fc\u30b8\u3067\u3042\u308c\u3070&#8217;edit.php&#8217;\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3067\u3042\u308c\u3070&#8217;edit.php?post_type=page&#8217;\u3068\u3044\u3046\u3088\u3046\u306b\u3001\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u30b9\u30e9\u30b0\u540d\u3092\u5408\u308f\u305b\u305f&#8217;admin.php?page=all_post&#8217;\u3068\u66f8\u304f\u306f\u305a\u3067\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001\u3053\u306e\u5834\u5408\u306f&#8217;all_post&#8217;\u3068\u3001add_menu_page \u306e\u3068\u304d\u306b\u6307\u5b9a\u3057\u305f\u30b9\u30e9\u30b0\u540d\u306e\u307f\u3092\u66f8\u304d\u307e\u3059\u3002<br \/>\n\u305d\u3046\u3059\u308b\u3068\u3001\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-3.png\" alt=\"article-picture-3\" width=\"1465\" height=\"466\" class=\"aligncenter size-full wp-image-5367\" srcset=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-3.png 1465w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-3-300x95.png 300w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-3-1024x326.png 1024w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/article-picture-3-768x244.png 768w\" sizes=\"auto, (max-width: 1465px) 100vw, 1465px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%81%AA%E3%81%9C%E5%80%A4%E3%81%AE%E6%9B%B8%E3%81%8D%E6%96%B9%E3%81%8C%E7%95%B0%E3%81%AA%E3%82%8B%E3%81%AE%E3%81%8B%EF%BC%9F\"><\/span>\u306a\u305c\u5024\u306e\u66f8\u304d\u65b9\u304c\u7570\u306a\u308b\u306e\u304b\uff1f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u3053\u308c\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30e1\u30cb\u30e5\u30fc\u3068\u30ab\u30b9\u30bf\u30e0\u306e\u30e1\u30cb\u30e5\u30fc\u306e\u4e21\u65b9\u3067\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5\u306f\u308f\u304b\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3057\u304b\u3057\u3001\u306a\u305c\u3053\u306e\u3088\u3046\u306a\u9055\u3044\u304c\u3042\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f\u8b0e\u3092\u89e3\u304f\u305f\u3081\u3001WordPress \u306e\u30b3\u30fc\u30c9\u3092\u8aad\u3093\u3067\u307f\u307e\u3059\u3002\u3059\u308b\u3068\u3001_add_post_type_submenus \u3068\u3044\u3046\u95a2\u6570\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"_add_post_type_submenus\"><\/span>_add_post_type_submenus<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><a href=\"https:\/\/github.com\/WordPress\/wordpress-develop\/blob\/1f144601785790fb4e19a750a75d7cd71d38db58\/src\/wp-includes\/post.php#L2096\">https:\/\/github.com\/WordPress\/wordpress-develop\/blob\/1f144601785790fb4e19a750a75d7cd71d38db58\/src\/wp-includes\/post.php#L2096<\/a><\/p>\n<pre>\r\nfunction _add_post_type_submenus() {\r\n  foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) {\r\n    $ptype_obj = get_post_type_object( $ptype );\r\n    \/\/ Sub-menus only.\r\n    if ( ! $ptype_obj->show_in_menu || true === $ptype_obj->show_in_menu ) {\r\n      continue;\r\n    }\r\n    add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, \"edit.php?post_type=$ptype\" );\r\n  }\r\n}\r\n<\/pre>\n<p>\u3053\u306e\u95a2\u6570\u3067\u306f\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u5168\u3066\u3068\u3063\u3066\u304d\u3066\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u306e show_in_menu \u306e\u5024\u304c bool \u578b\u3067\u306a\u3051\u308c\u3070\u3001add_submenu_page \u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306e\u6642\u3001show_in_menu \u306e\u5024\u306f\u7b2c 1 \u5f15\u6570\u3068\u3057\u3066\u5165\u308a\u307e\u3059\u3002<br \/>\n\u6b21\u306b\u3001add_submenu_page \u3092\u898b\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u95a2\u6570\u3067\u306f\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u5168\u3066\u3068\u3063\u3066\u304d\u3066\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u306e show_in_menu \u306e\u5024\u304c bool \u578b\u3067\u306a\u3051\u308c\u3070\u3001add_submenu_page \u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306e\u6642\u3001show_in_menu \u306e\u5024\u306f\u7b2c 1 \u5f15\u6570\u3068\u3057\u3066\u5165\u308a\u307e\u3059\u3002<br \/>\n\u6b21\u306b\u3001add_submenu_page \u3092\u898b\u3066\u307f\u307e\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"add_submenu_page_5\"><\/span>add_submenu_page <sup><a href=\"#user-content-fn-add_submenu_page-5818dbe52e1d5b1c3661955943a04c19\" id=\"user-content-fnref-add_submenu_page-5818dbe52e1d5b1c3661955943a04c19\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">5<\/a><\/sup><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><a href=\"https:\/\/github.com\/WordPress\/wordpress-develop\/blob\/1f144601785790fb4e19a750a75d7cd71d38db58\/src\/wp-admin\/includes\/plugin.php#L1404-L1495\">https:\/\/github.com\/WordPress\/wordpress-develop\/blob\/1f144601785790fb4e19a750a75d7cd71d38db58\/src\/wp-admin\/includes\/plugin.php#L1404-L1495<\/a><\/p>\n<pre>\r\nfunction add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {\r\n        global $submenu, $menu, $_wp_real_parent_file, $_wp_submenu_nopriv,\r\n                $_registered_pages, $_parent_pages;\r\n\r\n\r\n        $menu_slug   = plugin_basename( $menu_slug );\r\n        $parent_slug = plugin_basename( $parent_slug );\r\n\r\n        if ( ! isset( $submenu[ $parent_slug ] ) && $menu_slug !== $parent_slug ) {\r\n                foreach ( (array) $menu as $parent_menu ) {\r\n                        if ( $parent_menu[2] === $parent_slug && current_user_can( $parent_menu[1] ) ) {\r\n                                $submenu[ $parent_slug ][] = array_slice( $parent_menu, 0, 4 );\r\n                        }\r\n                }\r\n        }\r\n        $new_sub_menu = array( $menu_title, $capability, $menu_slug, $page_title );\r\n}\r\n<\/pre>\n<p>\u95a2\u6570\u306e\u4e2d\u8eab\u306f\u9577\u3044\u306e\u3067\u3001\u95a2\u4fc2\u304c\u3042\u308b\u3068\u3053\u308d\u3060\u3051\u629c\u304d\u51fa\u3057\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<br \/>\n\u307e\u305a\u3001show_in_menu \u306e\u5024\u306f$parent_slug\u306b\u5165\u308a\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001\u3044\u304f\u3064\u304b\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u3088\u3073\u3060\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u4e2d\u306e$submenu \u306e\u5024\u3092\u898b\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre>\r\nglobal $submenu;\r\nvar_dump($submenu);\r\n<\/pre>\n<p>var_dump \u306e\u7d50\u679c\u3068\u3057\u3066\u3001<\/p>\n<p>array(10) { [&#8220;index.php&#8221;]=&gt; array(2) { [0]=&gt; array(3) { [0]=&gt; string(9) &#8220;\u30db\u30fc\u30e0&#8221; [1]=&gt; string(4) &#8220;read&#8221; [2]=&gt; string(9) &#8220;index.php&#8221; } [10]=&gt; array(3) { [0]=&gt; string(86) &#8220;\u66f4\u65b0 3&#8221; [1]=&gt; string(11) &#8220;update_core&#8221; [2]=&gt; string(15) &#8220;update-core.php&#8221; } } [&#8220;upload.php&#8221;]=&gt; array(2) { [5]=&gt; array(3) { [0]=&gt; string(15) &#8220;\u30e9\u30a4\u30d6\u30e9\u30ea&#8221; [1]=&gt; string(12) &#8220;upload_files&#8221; [2]=&gt; string(10) &#8220;upload.php&#8221; } [10]=&gt; array(3) { [0]=&gt; string(12) &#8220;\u65b0\u898f\u8ffd\u52a0&#8221; [1]=&gt; string(12) &#8220;upload_files&#8221; [2]=&gt; string(13) &#8220;media-new.php&#8221; } } &#8230;&#8230;}<\/p>\n<p>\u3068\u3044\u3063\u305f\u914d\u5217\u304c\u5e30\u3063\u3066\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u914d\u5217\u306e\u4e2d\u3067\u6295\u7a3f\u30da\u30fc\u30b8\u3068\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u30da\u30fc\u30b8\u306e\u90e8\u5206\u3092\u629c\u304d\u51fa\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><strong>\u6295\u7a3f\u30da\u30fc\u30b8<\/strong><\/p>\n<p>[&#8220;edit.php&#8221;]=&gt; array(4) { [5]=&gt; array(3) { [0]=&gt; string(12) &#8220;\u6295\u7a3f\u4e00\u89a7&#8221; [1]=&gt; string(10) &#8220;edit_posts&#8221; [2]=&gt; string(8) &#8220;edit.php&#8221; } [10]=&gt; array(3) { [0]=&gt; string(12) &#8220;\u65b0\u898f\u8ffd\u52a0&#8221; [1]=&gt; string(10) &#8220;edit_posts&#8221; [2]=&gt; string(12) &#8220;post-new.php&#8221; } [15]=&gt; array(3) { [0]=&gt; string(15) &#8220;\u30ab\u30c6\u30b4\u30ea\u30fc&#8221; [1]=&gt; string(17) &#8220;manage_categories&#8221; [2]=&gt; string(31) &#8220;edit-tags.php?taxonomy=category&#8221; } [16]=&gt; array(3) { [0]=&gt; string(6) &#8220;\u30bf\u30b0&#8221; [1]=&gt; string(16) &#8220;manage_post_tags&#8221; [2]=&gt; string(31) &#8220;edit-tags.php?taxonomy=post_tag&#8221; }}<\/p>\n<p><strong>\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc<\/strong><\/p>\n<p>[&#8220;all_post&#8221;]=&gt; array(3) { [0]=&gt; array(4) { [0]=&gt; string(30) &#8220;\u3059\u3079\u3066\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f&#8221; [1]=&gt; string(14) &#8220;manage_options&#8221; [2]=&gt; string(8) &#8220;all_post&#8221; [3]=&gt; string(27) &#8220;\u6295\u7a3f\u30bf\u30a4\u30d7\u4e00\u89a7\u753b\u9762&#8221; } [1]=&gt; array(4) { [0]=&gt; string(10) &#8220;News \u4e00\u89a7&#8221; [1]=&gt; string(10) &#8220;edit_posts&#8221; [2]=&gt; string(23) &#8220;edit.php?post_type=news&#8221; [3]=&gt; string(4) &#8220;News&#8221; } [2]=&gt; array(4) { [0]=&gt; string(7) &#8220;Article&#8221; [1]=&gt; string(10) &#8220;edit_posts&#8221; [2]=&gt; string(26) &#8220;edit.php?post_type=article&#8221; [3]=&gt; string(7) &#8220;Article&#8221; } }<\/p>\n<p>$submenu[$parent_slug]\u306f\u3053\u306e\u5834\u5408\u3001$submenu[&#8216;edit.php&#8217;]\u3068\u3001$submenu[&#8216;all_post&#8217;]\u3067\u3059\u3002<br \/>\n\u3064\u307e\u308a add_submenu_page \u306e\u7b2c 1 \u5f15\u6570\u306f\u3001$submenu \u306e\u30ad\u30fc\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u540c\u3058\u3088\u3046\u306b$menu \u3082\u629c\u304d\u51fa\u3057\u307e\u3059\u3002<\/p>\n<pre>\r\nglobal $menu;\r\nvar_dump($menu);\r\n<\/pre>\n<p>var_dump \u306e\u7d50\u679c\u3068\u3057\u3066\u3001<\/p>\n<p>array(13) { [2]=&gt; array(7) { [0]=&gt; string(21) &#8220;\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9&#8221; [1]=&gt; string(4) &#8220;read&#8221; [2]=&gt; string(9) &#8220;index.php&#8221; [3]=&gt; string(0) &#8220;&#8221; [4]=&gt; string(43) &#8220;menu-top menu-top-first menu-icon-dashboard&#8221; [5]=&gt; string(14) &#8220;menu-dashboard&#8221; [6]=&gt; string(19) &#8220;dashicons-dashboard&#8221; } &#8230;&#8230;}<\/p>\n<p>\u3068\u3044\u3063\u305f\u914d\u5217\u304c\u5e30\u3063\u3066\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u914d\u5217\u306e\u4e2d\u3067\u3082\u6295\u7a3f\u30da\u30fc\u30b8\u3068\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u30da\u30fc\u30b8\u306e\u90e8\u5206\u3092\u629c\u304d\u51fa\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><strong>\u6295\u7a3f\u30da\u30fc\u30b8<\/strong><\/p>\n<p>[5]=&gt; array(7) { [0]=&gt; string(6) &#8220;\u6295\u7a3f&#8221; [1]=&gt; string(10) &#8220;edit_posts&#8221; [2]=&gt; string(8) &#8220;edit.php&#8221; [3]=&gt; string(0) &#8220;&#8221; [4]=&gt; string(52) &#8220;menu-top menu-icon-post open-if-no-js menu-top-first&#8221; [5]=&gt; string(10) &#8220;menu-posts&#8221; [6]=&gt; string(20) &#8220;dashicons-admin-post&#8221; }<\/p>\n<p><strong>\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc<\/strong><\/p>\n<p>[3]=&gt; array(7) { [0]=&gt; string(30) &#8220;\u3059\u3079\u3066\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f&#8221; [1]=&gt; string(14) &#8220;manage_options&#8221; [2]=&gt; string(8) &#8220;all_post&#8221; [3]=&gt; string(27) &#8220;\u6295\u7a3f\u30bf\u30a4\u30d7\u4e00\u89a7\u753b\u9762&#8221; [4]=&gt; string(45) &#8220;menu-top toplevel_page_all_post menu-top-last&#8221; [5]=&gt; string(22) &#8220;toplevel_page_all_post&#8221; [6]=&gt; string(19) &#8220;dashicons-menu-alt3&#8221; }<\/p>\n<p>\u6295\u7a3f\u30da\u30fc\u30b8\u3067\u306f[2]=&gt; string(8) &#8220;edit.php&#8221;\u3001\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u3067\u306f[2]=&gt; string(8) &#8220;all_post&#8221;\u3068\u3001\u6295\u7a3f\u30da\u30fc\u30b8\u3067\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u3001\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u3067\u306f\u30b9\u30e9\u30b0\u540d\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>$menu[2]\u306e\u5024\u306b\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u306f\u306a\u304f\u30b9\u30e9\u30b0\u540d\u304c\u5165\u3063\u3066\u3044\u308b\u306e\u306f\u306a\u305c\u3067\u3057\u3087\u3046\u304b\uff1f<br \/>\nadd_menu_page \u3092\u8abf\u3079\u3066\u307f\u307e\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"add_menu_page\"><\/span>add_menu_page<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><a href=\"https:\/\/github.com\/WordPress\/wordpress-develop\/blob\/1f144601785790fb4e19a750a75d7cd71d38db58\/src\/wp-admin\/includes\/plugin.php#L1309-L1370\">https:\/\/github.com\/WordPress\/wordpress-develop\/blob\/1f144601785790fb4e19a750a75d7cd71d38db58\/src\/wp-admin\/includes\/plugin.php#L1309-L1370<\/a><\/p>\n<pre>\r\nfunction add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = null ) {\r\n        global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;\r\n\r\n        $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url );\r\n\r\n        if ( null === $position || ! is_numeric( $position ) ) {\r\n                $menu[] = $new_menu;\r\n        } elseif ( isset( $menu[ (string) $position ] ) ) {\r\n                $collision_avoider = base_convert( substr( md5( $menu_slug . $menu_title ), -4 ), 16, 10 ) * 0.00001;\r\n                $position          = (string) ( $position + $collision_avoider );\r\n                $menu[ $position ] = $new_menu;\r\n        } else {\r\n\r\n                $position          = (string) $position;\r\n                $menu[ $position ] = $new_menu;\r\n<\/pre>\n<p>\u3053\u306e\u95a2\u6570\u3082\u95a2\u4fc2\u3057\u3066\u3044\u308b\u90e8\u5206\u3092\u629c\u304d\u51fa\u3057\u307e\u3059\u3002$new_menu\u3068\u3044\u3046\u914d\u5217\u306b\u5f15\u6570\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u306d\u3002<br \/>\n2\u756a\u76ee\u306f$menu_slug\u3001\u3064\u307e\u308a\u30b9\u30e9\u30b0\u540d\u3067\u3059\u3002<br \/>\n\u305d\u3057\u3066$new_menu\u3092$menu \u306b\u5165\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u308c\u304c2\u756a\u76ee\u306b\u30b9\u30e9\u30b0\u540d\u304c\u5165\u3063\u3066\u3044\u305f\u7406\u7531\u3067\u3059\u3002<\/p>\n<p>$submenu\u3068$menu \u306e\u4e2d\u8eab\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u3001\u3053\u306e2\u3064\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u90e8\u5206\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%B5%E3%83%96%E3%83%A1%E3%83%8B%E3%83%A5%E3%83%BC%E3%81%AE%E7%99%BB%E9%8C%B2\"><\/span>\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u306e\u767b\u9332<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre>\r\nif ( ! isset( $submenu[ $parent_slug ] ) && $menu_slug !== $parent_slug ) {\r\n                foreach ( (array) $menu as $parent_menu ) {\r\n                        if ( $parent_menu[2] === $parent_slug && current_user_can( $parent_menu[1] ) ) {\r\n                                $submenu[ $parent_slug ][] = array_slice( $parent_menu, 0, 4 );\r\n                        }\r\n                }\r\n        }\r\n        $new_sub_menu = array( $menu_title, $capability, $menu_slug, $page_title );\r\n<\/pre>\n<p>\u3053\u306e if \u6587\u3067\u306f\u3001\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u304c\u4e00\u5207\u5b58\u5728\u3057\u306a\u3044\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u5b58\u5728\u3057\u306a\u304b\u3063\u305f\u5834\u5408\u3001$menu\u306e2\u756a\u76ee\u3001\u3064\u307e\u308a\u30b9\u30e9\u30b0\u540d\u304c$parent_slug \u306e\u5024\u3068\u540c\u3058\u304b\u3069\u3046\u304b\u3068\u3001$menu\u306e1\u756a\u76ee\u3001\u6a29\u9650\u304ctrue\u3067\u3042\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3001true\u306a\u3089$submenu \u306b\u914d\u5217\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u306b\u3001\u30e1\u30cb\u30e5\u30fc\u3092\u8868\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3092\u8abf\u3079\u307e\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"menuphp\"><\/span>menu.php<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre>\r\nforeach ( $menu as $id => $data ) {\r\n        if ( empty( $submenu[ $data[2] ] ) ) {\r\n                continue;\r\n        }\r\n        $subs       = $submenu[ $data[2] ];\r\n        $first_sub  = reset( $subs );\r\n        $old_parent = $data[2];\r\n        $new_parent = $first_sub[2];\r\n<\/pre>\n<p>$menu\u306e2\u756a\u76ee\u3092\u53d6\u308a\u51fa\u3057\u3066$submenu \u306e\u30ad\u30fc\u306b\u5165\u308c\u3066\u3044\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u6295\u7a3f\u30da\u30fc\u30b8\u3067\u3042\u308c\u3070&#8217;edit.php&#8217;\u3001\u4eca\u56de\u4f5c\u6210\u3057\u305f\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u3067\u3042\u308c\u3070&#8217;all_post&#8217;\u3067\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E3%81%BE%E3%81%A8%E3%82%81\"><\/span>\u307e\u3068\u3081<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol>\n<li>\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u308c\u308b\u3082\u306e\u306f$submenu[$menu[2]]\u3002<\/li>\n<li>add_submenu_page \u3067\u306f\u3001\u521d\u3081\u3066\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3092\u767b\u9332\u3059\u308b\u969b\u3001\u7b2c 1 \u5f15\u6570\u3067\u3042\u308b$parent_slug\u304c\u30ad\u30fc\u3068\u306a\u308a\u3001$submenu[$parent_slug]\u306b\u767b\u9332\u3055\u308c\u308b\u3002show_in_menu \u3092\u6587\u5b57\u5217\u306b\u3059\u308b\u3068\u3001show_in_menu \u3092$parent_slug \u306e\u5024\u3068\u3057\u305f add_submenu_page \u304c\u547c\u3073\u51fa\u3055\u308c\u308b\u3002<\/li>\n<li>add_menu_page \u3067\u306f\u3001\u30b9\u30e9\u30b0\u540d\u3068\u3057\u3066\u6307\u5b9a\u3057\u305f\u5024\u304c$menu[2]\u306b\u5165\u308b\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30e1\u30cb\u30e5\u30fc\u3067\u306f\u3001$menu[2]\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u5165\u3063\u3066\u3044\u308b\u3002<\/li>\n<\/ol>\n<p>\u3064\u307e\u308a\u3001$menu[2]\u306b\u5165\u3063\u305f\u5024\u306e\u5dee\u304c\u3001show_in_menu \u306e\u66f8\u304d\u65b9\u306e\u9055\u3044\u3092\u751f\u3093\u3060\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f show_in_menu \u306e\u5024\u306e\u9055\u3044\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u7686\u3055\u3093\u306e\u7591\u554f\u306e\u89e3\u6d88\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<br \/>\n\u307e\u305f\u4f55\u304b\u65b0\u3057\u3044\u5b66\u3073\u304c\u3042\u308c\u3070\u3001\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83%E8%A8%98%E4%BA%8B\"><\/span><\/a>\u53c2\u8003\u8a18\u4e8b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<section data-footnotes=\"\" class=\"footnotes\">\n<h2 id=\"footnote-label\" class=\"sr-only\"><span class=\"ez-toc-section\" id=\"Footnotes\"><\/span>Footnotes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li id=\"user-content-fn-%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9\/register_post_type-5818dbe52e1d5b1c3661955943a04c19\">\n\u95a2\u6570\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\/register post type\uff08\u203b\u53c2\u8003\u306b\u3057\u305f\u65e5\u672c\u8a9e\u7248WordPressCodex\u8a18\u4e8b\u304c\u524a\u9664\u3055\u308c\u305f\u305f\u3081\u30ea\u30f3\u30af\u89e3\u9664\uff09\n<\/li>\n<li id=\"user-content-fn-register_post_type-5818dbe52e1d5b1c3661955943a04c19\">\n<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_post_type\/\">register_post_type<\/a>\n<\/li>\n<li id=\"user-content-fn-%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9\/add_menu_page-5818dbe52e1d5b1c3661955943a04c19\">\n\u95a2\u6570\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\/add_menu_page\uff08\u203b\u53c2\u8003\u306b\u3057\u305f\u65e5\u672c\u8a9e\u7248WordPressCodex\u8a18\u4e8b\u304c\u524a\u9664\u3055\u308c\u305f\u305f\u3081\u30ea\u30f3\u30af\u89e3\u9664\uff09\n<\/li>\n<li id=\"user-content-fn-add_menu_page-5818dbe52e1d5b1c3661955943a04c19\">\n<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_menu_page\/\">add_menu_page<\/a>\n<\/li>\n<li id=\"user-content-fn-add_submenu_page-5818dbe52e1d5b1c3661955943a04c19\">\n<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_submenu_page\/\">add_submenu_page<\/a>\n<\/li>\n<\/ol>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u8ffd\u52a0\u3057\u305f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092add_menu_page\u3067\u8ffd\u52a0\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u65b9\u6cd5\u3068\u3001\u305d\u306e\u969b\u306b\u5f15\u6570\u3067\u3042\u308bshow_in_menu\u306b\u8a2d\u5b9a\u3059\u308b\u5024\u306e\u66f8\u304d\u65b9\u304c\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u30e1\u30cb\u30e5\u30fc\u3068\u306f\u5c11\u3057\u7570\u306a\u308b\u7406\u7531\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":5370,"parent":0,"menu_order":0,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[],"class_list":["post-5361","customize","type-customize","status-publish","format-standard","has-post-thumbnail","hentry"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"\u682a\u5f0f\u4f1a\u793e\u30c7\u30b8\u30bf\u30eb\u30a2\u30a4\u30c7\u30f3\u30c6\u30a3\u30c6\u30a3 wp.geek\u7de8\u96c6\u90e8\"\/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"ja_JP\" \/>\n\t\t<meta property=\"og:site_name\" content=\"wp.geek | wp.geek\u3067\u306fWordPress\u306b\u95a2\u3059\u308b\u69d8\u3005\u306a\u60c5\u5831\u3092\u767a\u4fe1\u3057\u307e\u3059\u3002\u30ef\u30fc\u30c9\u30d7\u30ec\u30b9\u3067\u306e\u30b5\u30a4\u30c8\u5236\u4f5c\u306b\u643a\u308f\u308b\u5168\u3066\u306e\u65b9\u306b\u5f79\u7acb\u3064\u60c5\u5831\u3092\u3054\u63d0\u4f9b\u3057\u3066\u3044\u304d\u307e\u3059\u3002\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092add_menu_page\u3067\u8ffd\u52a0\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b | wp.geek\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/show-in-menu-submenu-1.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/show-in-menu-submenu-1.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t\t<meta property=\"og:image:height\" content=\"800\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2023-09-09T02:51:04+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-06-27T09:59:09+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092add_menu_page\u3067\u8ffd\u52a0\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b | wp.geek\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/show-in-menu-submenu-1.jpg\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092add_menu_page\u3067\u8ffd\u52a0\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b | wp.geek","description":"","canonical_url":false,"robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"ja_JP","og:site_name":"wp.geek | wp.geek\u3067\u306fWordPress\u306b\u95a2\u3059\u308b\u69d8\u3005\u306a\u60c5\u5831\u3092\u767a\u4fe1\u3057\u307e\u3059\u3002\u30ef\u30fc\u30c9\u30d7\u30ec\u30b9\u3067\u306e\u30b5\u30a4\u30c8\u5236\u4f5c\u306b\u643a\u308f\u308b\u5168\u3066\u306e\u65b9\u306b\u5f79\u7acb\u3064\u60c5\u5831\u3092\u3054\u63d0\u4f9b\u3057\u3066\u3044\u304d\u307e\u3059\u3002","og:type":"article","og:title":"\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092add_menu_page\u3067\u8ffd\u52a0\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b | wp.geek","og:image":"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/show-in-menu-submenu-1.jpg","og:image:secure_url":"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/show-in-menu-submenu-1.jpg","og:image:width":1200,"og:image:height":800,"article:published_time":"2023-09-09T02:51:04+00:00","article:modified_time":"2024-06-27T09:59:09+00:00","twitter:card":"summary_large_image","twitter:title":"\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092add_menu_page\u3067\u8ffd\u52a0\u3057\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b | wp.geek","twitter:image":"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/09\/show-in-menu-submenu-1.jpg"},"aioseo_meta_data":{"post_id":"5361","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"WebPage","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2023-09-09 02:43:10","updated":"2024-06-27 10:10:44","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"_links":{"self":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize\/5361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize"}],"about":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/types\/customize"}],"author":[{"embeddable":true,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":12,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize\/5361\/revisions"}],"predecessor-version":[{"id":6876,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize\/5361\/revisions\/6876"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/media\/5370"}],"wp:attachment":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/media?parent=5361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/categories?post=5361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}