Create Menu/Submenu

  • 3 years-4 months

    Create Menu/Submenu

    • Category : wordpress
    • Viewed : 121 times
    • Posted On :
    • Posted by : Guley

    Create custom menu and sub-menu in worpress

    add_action('admin_menu', 'main_menu');
    function main_menu()
       add_menu_page( 'Setting' , 'Setting' , 'manage_options' , __FILE__ , 'setting');
       add_submenu_page( __FILE__ , 'Submenu1', 'Submenu1' , 'manage_options' , __FILE__ . 'Submenu1' , 'Submenu1');
    /* Menu*/
    function Submenu1(){
    	echo "Submenu1 Page";
    /* Sub Menu*/
    function setting(){
    	echo "Setting Page";

Report this or Ask your own question

Your Answer

When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.