Skip to content

Instantly share code, notes, and snippets.

@d4mation
Created December 21, 2016 16:13
Show Gist options
  • Select an option

  • Save d4mation/f72bde54d532960d35045ac22c06e90d to your computer and use it in GitHub Desktop.

Select an option

Save d4mation/f72bde54d532960d35045ac22c06e90d to your computer and use it in GitHub Desktop.

Revisions

  1. d4mation revised this gist Dec 21, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions non-admin-site-identity-wp.php
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    */
    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';
    $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';
    }
  2. d4mation created this gist Dec 21, 2016.
    14 changes: 14 additions & 0 deletions non-admin-site-identity-wp.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?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';
    }