While I can't attest to why read
isn't working - generally if you want to limit something by user roles, you can put in the slug for the role. If you read the source for add_menu_page()
it will actually run the capability through current_user_can
which accepts a role slug as well.
I would replace read
with editor
and see what that gets you. It will also work for admins since it propagates down the list and administrators
all have the editor
, contributor
, etc. "capabilities".
Edit: It appears you have the Instagram Feed plugin installed which will be conflicting with your custom plugin. The code from that plugin shows the sb-instagram-feed
page belongs to that plugin:
function sb_instagram_menu() {
add_menu_page(
__( 'Instagram Feed', 'instagram-feed' ),
__( 'Instagram Feed', 'instagram-feed' ),
'manage_options',
'sb-instagram-feed',
'sb_instagram_settings_page'
);
add_submenu_page(
'sb-instagram-feed',
__( 'Settings', 'instagram-feed' ),
__( 'Settings', 'instagram-feed' ),
'manage_options',
'sb-instagram-feed',
'sb_instagram_settings_page'
);
}
add_action('admin_menu', 'sb_instagram_menu');
And that plugin requires manage_options
, an administrator
only capability. You'll need to not link to the page that other plugin makes, or deactivate that plugin.
Edit 2: Note that editing plugin files directly usually isn't a great practice as any changes you make will be overwritten when the plugin is updated. You might be able to unhook the current admin menu for it and hook in your custom one.
// Remove Existing Menu
remove_action( 'admin_menu', 'sb_instagram_menu' );
// Add Custom Menu
add_action( 'admin_menu', 'custom_sb_instagram_menu');
function custom_sb_instagram_menu() {
add_menu_page(
'Instagram Test',
'Instagram Test',
'editor',
'sb-instagram-feed',
'sb_instagram_settings_page'
);
add_submenu_page(
'sb-instagram-feed',
'Test Settings',
'Test Settings',
'editor',
'sb-instagram-feed',
'sb_instagram_settings_page'
);
}