Issue with Developing a WordPress Plugin

Change this line:

add_menu_page(__('EM Collaboration All Groups', 'em-collaboration'), __('EM Collaboration', 'em-collaboration'), NULL, 'em-collab-top', NULL, '', 21);

to:

add_menu_page(__('EM Collaboration All Groups', 'em-collaboration'), __('EM Collaboration', 'em-collaboration'), 'manage_options', 'em-collab-top', NULL, '', 21);

The third argument in this function is asking for the capability required to access the page, you had it set to null, which is not a valid capability.

Also in the add_menu function you have everything wrapped in is_admin(). This is not needed, and doesn’t work the way it may sound. It isn’t checking if the current user is an administrator, it is checking if the screen being viewed is in the wp-admin area. Which all admin pages of course are by nature.

Leave a Comment