add_menu_page not show link for custom role


I write a custom plugin, with one link for administration purpose.
This is my code:

add_action('admin_menu', 'tb_instructor_menu');
add_action( 'init', 'aggiungi_ruolo', 11 );
function aggiungi_ruolo() 
$role = get_role( 'wdm_instructor' );
$role->add_cap( 'view_webinar', true );
function tb_instructor_menu()
add_menu_page('My code', 'My code', 'view_webinar', 'my-code', null, 'dashicons-businessman' , 61);

If I am logged in as Admin, I see the link.

If I’m logged in as “wdm_instructor”, I don’t see the link.

I have already verified that the “wdm_instructor” role has the “view_webinar” capability flagged.

Infocurci 4 years 2020-05-29T08:10:19-05:00 0 Answers 76 views 0

Leave an answer