Reputation: 165
I need two roles have access to a menu created in wordpress (Roles: Editor and Custom Role). I wonder if you are doing this? I'm using it to add a role:
add_menu_page('Test CPF', 'Teste CPF', 'custom_role', 'test_cpf', 'test_cpf', 'dashicons-welcome-write-blog', '19' );
this working, but this only add to custom_role to type "editor" does not appear
I tried this solution I read, but also did not work:
add_menu_page('Test CPF', 'Teste CPF', 'custom_role', 'test_cpf*', 'test_cpf', 'dashicons-welcome-write-blog', '19' );
add_menu_page('Test CPF', 'Teste CPF', 'editor', 'test_cpf', 'test_cpf', 'dashicons-welcome-write-blog', '19' );
someone help me?
Upvotes: 1
Views: 1820
Reputation: 11808
The third parameter of the add_menu_page() is "capability" and you have passed "role" into it.
Syntax : add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
Try the below code :
add_menu_page('Test CPF', 'Teste CPF', array('edit_others_posts','capability_of_custom_role'), 'test_cpf', 'test_cpf', 'dashicons-welcome-write-blog', '19' );
Upvotes: 1