WordPress Editing Editor Role

I came across a situation recently where I needed to allow an user with the ‘Editor’ role to edit the layout of the menu. Interesting fact, WordPress does not allow ‘Editor’ or lower edit anything appearance-wise. Another fact, someone figured out an easy way to allow menu and widget changes with some PHP in functions.php.

// get the the role object
$role_object = get_role( 'editor' );

// add $cap capability to this role object
$role_object->add_cap( 'edit_theme_options' );

The source of this code comes from here and is put directly into the themes functions.php file. The best part about this is, when an Editor accesses the Appearance tab, they cannot change the theme. That right is still reserved for Admins and above.

So if you’re running into the same issue, snag this code and use it!

For more code tips, click here.

Notify of
Inline Feedbacks
View all comments

John Hartley is a Director of Product Engineering at Beam Dental in Columbus, OH. With 5+ years of leadership experience he has worked in startups, agencies, and began his career as a freelance Front End Developer. Always looking to iterate, this blog is a place for him to share his knowledge as well as hone his craft, challenge assumptions, and build a strong base of leadership and management knowledge. Connect with him on LinkedIn

Would love your thoughts, please comment.x