Skip to content

Instantly share code, notes, and snippets.

@d4mation
Created December 21, 2016 16:13
Show Gist options
  • Save d4mation/f72bde54d532960d35045ac22c06e90d to your computer and use it in GitHub Desktop.
Save d4mation/f72bde54d532960d35045ac22c06e90d to your computer and use it in GitHub Desktop.
Grant non-admins Site Identity Options in WordPress
<?php
/**
* Allows certain Customizer Settings to not require `manage_options`
* Since no one wants to give Clients Admin Access if they don't have to.
*
* You will need to grant them `edit_theme_options` for this example, which will also give them access to the Customizer
*/
add_action( 'customize_register', 'add_site_identity_for_non_admins' );
function add_site_identity_for_non_admins( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->capability = 'edit_theme_options';
$wp_customize->get_setting( 'blogdescription' )->capability = 'edit_theme_options';
$wp_customize->get_setting( 'site_icon' )->capability = 'edit_theme_options';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment