[wp-trac] [WordPress Trac] #32739: Allow Non-administrators to Access the Customizer
WordPress Trac
noreply at wordpress.org
Wed Jul 1 05:57:13 UTC 2015
#32739: Allow Non-administrators to Access the Customizer
--------------------------+----------------------
Reporter: y2kand13 | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Customize | Version: 4.2
Severity: normal | Resolution: invalid
Keywords: | Focuses:
--------------------------+----------------------
Comment (by westonruter):
I think using the `map_meta_cap` filter maybe confused things. I've also
used the following `user_has_cap` filter to grant `customize` cap to users
who can `edit_posts`:
{{{#!php
<?php
function grant_customize_cap_to_users_who_can_edit_posts( $allcaps, $caps,
$args ) {
if ( ! empty( $allcaps['edit_posts'] ) && ! empty( $args ) &&
'customize' === $args[0] ) {
$allcaps = array_merge( $allcaps, array_fill_keys( $caps,
true ) );
}
return $allcaps;
}
add_filter( 'user_has_cap',
'grant_customize_cap_to_users_who_can_edit_posts', 10, 3 );
}}}
If this is also wrong, by all means someone set me straight :-)
/cc @y2kand13
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32739#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list