Created
December 21, 2016 16:13
-
-
Save d4mation/f72bde54d532960d35045ac22c06e90d to your computer and use it in GitHub Desktop.
Grant non-admins Site Identity Options in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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