Skip to content

Instantly share code, notes, and snippets.

@wpmark
Created May 3, 2014 13:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wpmark/b11ab3395dacebc9f8d7 to your computer and use it in GitHub Desktop.
Save wpmark/b11ab3395dacebc9f8d7 to your computer and use it in GitHub Desktop.
Allow WordPress Editors Access to Widgets and Menus
<?php
/***************************************************************
* Function pxlcore_give_edit_theme_options()
* Adds widgets and menus to editors.
***************************************************************/
function pxlcore_give_edit_theme_options( $caps ) {
/* check if the user has the edit_pages capability */
if( ! empty( $caps[ 'edit_pages' ] ) ) {
/* give the user the edit theme options capability */
$caps[ 'edit_theme_options' ] = true;
}
/* return the modified capabilities */
return $caps;
}
add_filter( 'user_has_cap', 'pxlcore_give_edit_theme_options' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment