Allow WordPress Editors Access to Widgets & Menus

This is something that I have been pondering for a while now and that is how to allow WordPress users that are the editor role to be able to manage widgets and menus. Sometimes although you don’t want these users to have admin rights on the site they may need to edit the sites widgets and menus. Having watched Andrew Nacin’s talk on titled “Current User Can Watch This Talk”┬áhe gave an excellent example of a really easy way to do this. Just pop the code below into your themes functions.php file or better still into a plugin.


Damion November 3, 2014 Reply

tried this but gave them access to all the widgets and appearance controls even though I added it to only one widget.

Mark Wilkinson November 3, 2014 Reply

This gives them access to the Appearance > Widgets section in the WordPress dashboard. It will also give them access to any other sections that require the user to have the edit_theme_options cap.

Samuel February 19, 2015 Reply

If you only want Editors to have Widget access, you can use this to remove access to the Theme and Navigation menu items;

function custom_admin_menu() {

$user = new WP_User(get_current_user_id());
if (!empty( $user->roles) && is_array($user->roles)) {
foreach ($user->roles as $role)
$role = $role;

if($role == "editor") {
remove_submenu_page( 'themes.php', 'themes.php' );
remove_submenu_page( 'themes.php', 'nav-menus.php' );

add_action('admin_menu', 'custom_admin_menu');

Rigo July 11, 2015 Reply

Quick question: Where exactly does this code go? Functions.php?

Mark Wilkinson July 11, 2015 Reply

Place this in your themes functions.php file or in a plugin.

Gustavo Portillo May 17, 2016 Reply

Hi Samuel,
Thanks for the snippet of code! however I can’t get this to work. These are the steps that I did:
1. created a new user and assigned him as “Editor”
2. Applied code into my theme’s functions.php
3. Logged in as the new “user” but I could not see the “Appearances” options

Not sure If I missed a step, but I would appreciate if you could help me what I did wrong

Tom June 22, 2017 Reply

That really just removes it from the menu based on their role. They can still access it and cause mayhem via the URL.

gurkan March 26, 2015 Reply

Thank you so much, it works!!!

Sherry September 10, 2015 Reply

Can I add a role function that will allow me to show certain widgets to certain roles (or hide other based on roles)?
if($role == “humanresources”) {
show_widget( ‘widget-17_text-31’ );

Mark Wilkinson September 10, 2015 Reply

Hi Sherry, I am not sure about that as it is not something I have done but it sounds like a good idea to be honest. Let me know if you manage it!

samer kalifa April 5, 2018 Reply

This is something I’ve been thinking about for a while, so WordPress users who have the role of the editor can be able to manage widgets and menus. Sometimes you do not want these users to have administrative privileges on the site, but they may need to edit the widgets and menus of the sites. After watching Andrew Nacin’s talk on titled “The Current User Can See This Post”, he gave a great example of a really easy way to do it. Just put the code below in the themes functions.php file or better yet plug it into a plugin.

Leave a Reply