How to change menu page capability

Is it possible to change the capability set for a menu page, previously added with add_menu_page()?

I have a third plugin installed, that set a menu page created with a 'manage_options' capability, and severals submenus with the same capability:

add_menu_page( $title, __( 'Menu Example','menu-example' ), 'manage_options', $page, null , $icon_url );

add_submenu_page( $parent, $title1, $title1, 'manage_options', $page1 , $function1 );
add_submenu_page( $parent, $title2, $title2, 'manage_options', $page2 , $function2 );
add_submenu_page( $parent, $title3, $title3, 'manage_options', $page3 , $function3 );
add_submenu_page( $parent, $title4, $title4, 'manage_options', $page4 , $function4 );

I would like in my plugin to change the capability for this parent menu and only 2 submenus, and set my-custom-capability for this. I need this because I have a custom rol with limit menu pages.

0

Leave a Comment