I'm using the following snippet to add a menu item:
<?php
add_menu_page(
'Foo Server',
'Foo Server',
'manage_options',
'foo-server',
array('Class', 'method')
);
?>
Fine, it's displayed. But clicking on it returns:
You do not have sufficient permissions to access this page.
I really don't know what to do.
Any idea? Thanks
UPDATE: Problem fixed. I was registering the menu using the wrong hook:
add_action('admin_init', 'function that runs the above code!');
must be:
add_action('admin_menu', 'function that runs the above code!');
Thanks.