[resolved] add_menu_page() | passing a $variable with called function (2 posts)

  1. mediabros
    Posted 5 years ago #

    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.


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

  2. mediabros
    Posted 5 years ago #

    closed, i have to read the codex more often.

Topic Closed

This topic has been closed to new replies.

About this Topic