Support » Plugins » add_menu_page() | passing a $variable with called function

  • Resolved mediabros

    (@mediabros)


    I have added a menu page on my WordPress backend with some submenu items.

    a snippet of the code i use is:

    // Add to admin_menu function
    add_menu_page(__('New Menu'), __('New Menu Title'), 'edit_themes', 'new_menu_item', 'functiontocallonclick', '', 3.5); 
    
    // Add to secondlevel menu
    add_submenu_page('new_menu_item', __('New |Sub Menu item'), __('New Menu Title item'), 'edit_themes', 'new_menu_sub_item', 'subfunctiontocallonclick',');

    As you can see above it is calling the function functiontocallonclick when you go to the New menu item in the backend.

    What i am wondering now:

    I would like to pass a variable with the function.

    functiontocallonclick($value);

    Ofcourse it can’t be done that way, so what is the good way?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘add_menu_page() | passing a $variable with called function’ is closed to new replies.