Support » Plugins » add_submenu_page calls all functions wierdness

  • Resolved ianhaycox

    (@ianhaycox)


    I’ve created submenus sucessfully but selecting any sub menu option calls ALL the submenu functions not just the one defined for the submenu. E.g.

    class myadmin extends myplugin {
      function addmenus() {
        add_menu_page('top','top',10,__FILE__,array($this,'top'));
        add_submenu_page(__FILE__,'sub1','sub1',10,__FILE__,
         array($this,'sub1'));
        add_submenu_page(__FILE__,'sub2','sub2',10,__FILE__,
         array($this,'sub2'));
      }
      function top() {echo 'top';}
      function sub1() {echo 'sub1';}
      function sub2() {echo 'sub2';}
    }

    clicking on any menu option echos top sub1 sub2

    All the functions are called. This does not seem right. I expected
    either top OR sub1 OR sub2 to be echoed not all of them.

    Anyone have any ideas ? I’ve been searching and trying various combinations for hours and getting very frustrated.

    Thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘add_submenu_page calls all functions wierdness’ is closed to new replies.