{"id":95517,"date":"2017-09-11T05:49:17","date_gmt":"2017-09-11T05:49:17","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=95517"},"modified":"2017-09-12T07:20:32","modified_gmt":"2017-09-12T07:20:32","slug":"wordpress-custom-menu","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/","title":{"rendered":"WordPress Custom Menu"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>Default menu\u00a0in wordpress are like Dashboard, Posts, Media, Comments, Plugins, etc. So, if we want to create a custom menu item of our own, we can can follow the following steps.<\/p>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<div>\n<h3 class=\"panel-title\">Code Snippet<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<pre class=\"brush:php\">add_action( \"admin_menu\", \"custom_admin_menu\" );\r\n\r\nfunction custom_admin_menu(){\r\n\r\n   add_menu_page(\r\n\r\n    __( \"Custom Menu\", \"text domain\" ),\r\n\r\n    __( \"Custom Menu\", \"text domain\" ),\r\n\r\n    'manage_options', \/\/ access restriction\r\n\r\n    'custom-menu', \/\/ menu slug\r\n\r\n    'custom_menu_callback_function', \/\/ callback function\r\n\r\n    'dashicon', \/\/ image\r\n\r\n    25 \/\/ menu order\r\n\r\n  );\r\n\r\n  add_submenu_page(\r\n\r\n    'custom-menu', \/\/ Parent menu slug\r\n\r\n    __( \"Custom Sub Menu\", \"text domain\" ),\r\n\r\n    __( \"Custom Sub Menu\", \"text domain\"),\r\n\r\n    'manage_options', \/\/ access restriction\r\n\r\n    'manage-submenu', \/\/ slug\r\n\r\n    'custom_submenu_callback_function' \/\/ callback function\r\n\r\n  );\r\n\r\n}\r\n\r\nfunction custom_menu_callback_function(){\r\n  \/\/ html template for menu goes here...\r\n}\r\n\r\nfunction custom_submenu_callback_function(){\r\n  \/\/ html template for submenu goes here...\r\n}\r\n\r\n<\/pre>\n<\/div>\n<\/div>\n<div class=\"panel panel-primary\">\n<div class=\"panel-heading\">\n<div>\n<h3 class=\"panel-title\">Support<\/h3>\n<\/div>\n<\/div>\n<div class=\"panel-body\">\n<div>\n<p>Still have any issue feel free to add a ticket and let us know your views to make the code better\u00a0<a href=\"https:\/\/webkul.uvdesk.com\/en\/customer\/create-ticket\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/webkul.uvdesk.com\/en\/customer\/create-ticket\/<\/a><\/p>\n<p>Thanks for Your Time! Have a Good Day!<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Default menu\u00a0in wordpress are like Dashboard, Posts, Media, Comments, Plugins, etc. So, if we want to create a custom menu item of our own, we can can follow the following steps. Code Snippet add_action( &#8220;admin_menu&#8221;, &#8220;custom_admin_menu&#8221; ); function custom_admin_menu(){ add_menu_page( __( &#8220;Custom Menu&#8221;, &#8220;text domain&#8221; ), __( &#8220;Custom Menu&#8221;, &#8220;text domain&#8221; ), &#8216;manage_options&#8217;, \/\/ <a href=\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":111,"featured_media":95679,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1260],"tags":[],"class_list":["post-95517","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom Menu in Wordpress<\/title>\n<meta name=\"description\" content=\"This blog explains the step and hook used to create a custom menu and its submenu in Wordpress.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom Menu in Wordpress\" \/>\n<meta property=\"og:description\" content=\"This blog explains the step and hook used to create a custom menu and its submenu in Wordpress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-11T05:49:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-09-12T07:20:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ayush Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ayush Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\"},\"author\":{\"name\":\"Ayush Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/5deb39718ae59fa5659a825549b7df4a\"},\"headline\":\"WordPress Custom Menu\",\"datePublished\":\"2017-09-11T05:49:17+00:00\",\"dateModified\":\"2017-09-12T07:20:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\"},\"wordCount\":75,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png\",\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\",\"url\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\",\"name\":\"Custom Menu in Wordpress\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png\",\"datePublished\":\"2017-09-11T05:49:17+00:00\",\"dateModified\":\"2017-09-12T07:20:32+00:00\",\"description\":\"This blog explains the step and hook used to create a custom menu and its submenu in Wordpress.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Custom Menu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/5deb39718ae59fa5659a825549b7df4a\",\"name\":\"Ayush Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3488792c5856a76629020ea17053d952aa9915d88309f1f38e901acce88408d2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3488792c5856a76629020ea17053d952aa9915d88309f1f38e901acce88408d2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ayush Singh\"},\"sameAs\":[\"http:\/\/webkul.com\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/ayush-singh265\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom Menu in Wordpress","description":"This blog explains the step and hook used to create a custom menu and its submenu in Wordpress.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/","og_locale":"en_US","og_type":"article","og_title":"Custom Menu in Wordpress","og_description":"This blog explains the step and hook used to create a custom menu and its submenu in Wordpress.","og_url":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-09-11T05:49:17+00:00","article_modified_time":"2017-09-12T07:20:32+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png","type":"image\/png"}],"author":"Ayush Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ayush Singh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/"},"author":{"name":"Ayush Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/5deb39718ae59fa5659a825549b7df4a"},"headline":"WordPress Custom Menu","datePublished":"2017-09-11T05:49:17+00:00","dateModified":"2017-09-12T07:20:32+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/"},"wordCount":75,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png","articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/","url":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/","name":"Custom Menu in Wordpress","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png","datePublished":"2017-09-11T05:49:17+00:00","dateModified":"2017-09-12T07:20:32+00:00","description":"This blog explains the step and hook used to create a custom menu and its submenu in Wordpress.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/wordpress-custom-menu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/09\/download-2-2.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/wordpress-custom-menu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"WordPress Custom Menu"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/5deb39718ae59fa5659a825549b7df4a","name":"Ayush Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3488792c5856a76629020ea17053d952aa9915d88309f1f38e901acce88408d2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3488792c5856a76629020ea17053d952aa9915d88309f1f38e901acce88408d2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ayush Singh"},"sameAs":["http:\/\/webkul.com"],"url":"https:\/\/webkul.com\/blog\/author\/ayush-singh265\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/95517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/111"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=95517"}],"version-history":[{"count":5,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/95517\/revisions"}],"predecessor-version":[{"id":95539,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/95517\/revisions\/95539"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/95679"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=95517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=95517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=95517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}