I'm currently building a website for a friend and have assigned him the user role of editor. I don't want to give him an administrator role in case he breaks the layout. Anyway, I am using 'add_menu_page()' to add the Appearance > Menus page as an option for the Editor and it is showing up when I log in as an editor role, but when I click on it it says "You do not have sufficient permissions to access this page.

Here is my code:

add_action( 'admin_menu', 'register_my_custom_menu_page' );

function register_my_custom_menu_page(){
    add_menu_page( 'custom menu title', 'custom menu', 'edit_others_posts', 'nav-menus.php' ); 

I saw something in the codex that says if you see this message you have hooked in to early. I'm not very familiar with hooks and filters though, so I'm not sure what that means.

  • 1
    Did you solve this? Having the same problem – chaim Jan 19 '16 at 15:50
  • check my answer – Nabeel Khan Apr 20 '16 at 8:39

Run this once, it will be saved in database. You can run it once by adding it to functions.php and reloading the site once.

$user = new WP_User( $user_id ); // the user id you want to have that capability
$user->add_cap( 'edit_others_posts' ); // or any other capability that you want

Try this way :

 add_menu_page( 'custom menu title', 'custom menu', 'manage_options', 'nav-menus.php' ); 

For more info visit this link

  • That doesn't work for editor because they don't have manage_options capability. – chap Jul 26 '14 at 7:37
  • You should be giving the user or role the right capability rather than trying to add the page again. You might make the page link appear in the menu but further capability checks will still fail. – Andy Macaulay-Brook Jul 24 '16 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.