Skip to content

Instantly share code, notes, and snippets.

@jimmy89Li
Created September 28, 2016 07:23
Show Gist options
  • Save jimmy89Li/9463bb8ca76587f824cd70e1b715511e to your computer and use it in GitHub Desktop.
Save jimmy89Li/9463bb8ca76587f824cd70e1b715511e to your computer and use it in GitHub Desktop.
Allow the editor to edit theme options
// Allow the editor to edit theme options
function add_theme_caps() {
// gets the editor role
$role = get_role( 'editor' );
// This only works, because it accesses the class instance.
// would allow the editor to edit options posts for current theme only
$role->add_cap( 'manage_options' );
}
add_action( 'admin_init', 'add_theme_caps');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment