[wp-trac] [WordPress Trac] #32772: Filter for disabling Customizer
WordPress Trac
noreply at wordpress.org
Wed Jul 1 08:30:10 UTC 2015
#32772: Filter for disabling Customizer
---------------------------+-----------------------------
Reporter: hereswhatidid | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Customize | Version: trunk
Severity: normal | Resolution: invalid
Keywords: | Focuses: administration
---------------------------+-----------------------------
Comment (by andreasnrb):
Replying to [comment:6 Viper007Bond]:
> Replying to [comment:5 hereswhatidid]:
> > Well, I guess you know my clients needs better than I. Thanks for
setting me straight.
>
> As @celloexpressions explained, if you really do want to disable it,
then you ''can'' disable it, but via a method that makes sense:
capabilities. You're wanting to prevent user X from doing action Y which
is exactly what capabilities, not filters, are designed for.
>
> And modifying capabilities is not difficult (and there might even be a
better way than this):
>
> {{{
> add_filter( 'user_has_cap' , function( $allcaps ) {
> unset( $allcaps['edit_theme_options'] );
> return $allcaps;
> } );
> }}}
>
> The admin bar is different in that it's a feature and not a tool. The
context "can user X use the admin toolbar" doesn't make as much sense as
"should the toolbar be enabled".
WordPress is the tool the Customizer is just a feature, same as the admin
bar. Both admin bar and customizer is about making it easier(although the
opinion on that differs greatly) for endusers to do things. Manipulating
capabilities on a per user basis is just weird. Being able to turn parts
of WP off completly with an on off switch is much more sensible.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32772#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list