WordPress Editing Editor Role

Posted on: February 29th, 2012

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.

Tags: , , ,

previous post: Golf Road Warriors Palm Springs next post: PHP Random Image