Default menu in 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( "admin_menu", "custom_admin_menu" ); function custom_admin_menu(){ add_menu_page( __( "Custom Menu", "text domain" ), __( "Custom Menu", "text domain" ), 'manage_options', // access restriction 'custom-menu', // menu slug 'custom_menu_callback_function', // callback function 'dashicon', // image 25 // menu order ); add_submenu_page( 'custom-menu', // Parent menu slug __( "Custom Sub Menu", "text domain" ), __( "Custom Sub Menu", "text domain"), 'manage_options', // access restriction 'manage-submenu', // slug 'custom_submenu_callback_function' // callback function ); } function custom_menu_callback_function(){ // html template for menu goes here... } function custom_submenu_callback_function(){ // html template for submenu goes here... }
Support
Still have any issue feel free to add a ticket and let us know your views to make the code better https://webkul.uvdesk.com/en/customer/create-ticket/
Thanks for Your Time! Have a Good Day!
2 comments