[wp-trac] [WordPress Trac] #43877: Do not run unnecessary `user_has_cap` filter if the caps to check for include `do_not_allow` already

WordPress Trac noreply at wordpress.org
Mon Sep 17 11:21:33 UTC 2018


#43877: Do not run unnecessary `user_has_cap` filter if the caps to check for
include `do_not_allow` already
----------------------------------------+------------------------------
 Reporter:  flixos90                    |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Role/Capability             |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:
----------------------------------------+------------------------------

Comment (by johnbillion):

 I agree that this makes sense, however I have an interesting caveat. My
 [https://wordpress.org/plugins/query-monitor/ Query Monitor] plugin uses
 the `user_has_cap` filter for debugging capability checks. With this
 short-circuiting in place I'll have to modify the plugin to handle that
 specific situation via the `map_meta_cap` filter. This isn't a problem,
 but it might affect other plugins in a similar way if they're expecting
 the `user_has_cap` filter to fire for all capability checks on non-
 Multisite installations.

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


More information about the wp-trac mailing list