[wp-trac] [WordPress Trac] #32772: Filter for disabling Customizer

WordPress Trac noreply at wordpress.org
Wed Jul 1 01:34:04 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 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".

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32772#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list