WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was use to pass value to function for the below menu.

add_menu_page('Competition Manager 2013-2014', '2013-2014', 'manage_options', 'manager_2013_2014', 'manager_2013_2014', plugins_url( 'competition-manager/images/cup.png' ), 81 );
share|improve this question
This is not clear. Please expand upon the description of the problem. – s_ha_dum Apr 30 '14 at 21:53

Don’t use a function for the callback, use a class. Something like this:

class Competition_Manager_Page
    private $extra;

    public function set_extra( $value )
        $this->extra = $value;

    public function render()
        // show you page content, then:
        print $this->extra;

You can extend the class’ functionality later.

Now, when you register the menu, create an instance of that class first, and add you extra data:

$page = new Competition_Manager_Page;
$page->set_extra( 'Test' );

    'Competition Manager 2013-2014',
    array( $page, 'render' ), // replacement for the former function
    plugins_url( 'competition-manager/images/cup.png' ), 81
share|improve this answer
Thanks for the replay! – user1581151 May 6 '14 at 7:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.