Let's take a look at Codex page for add_menu_page
...
Third param is:
$capability (string) (Required) The capability required for this menu
to be displayed to the user.
And later on in Notes section:
This function takes a ‘capability’ (see Roles and Capabilities) which
will be used to determine whether or not a page is included in the
menu. The function which is hooked in to handle the output of the page
must check that the user has the required ‘capability’ as well.
As you can see, you should use capability (for example manage_options
, publish_posts
) and not user role (editor
, subscriber
) as that param.
So if you'll pass publish_pages
as third param, only Editor, Administrator, and Super Admin will get access to that page.
Here you can find list of default capabilities for default user roles.