[wp-trac] [WordPress Trac] #43421: The $capabilities argument in the `add_role()` function is incompatible with `user_can`

WordPress Trac noreply at wordpress.org
Mon Feb 26 17:24:06 UTC 2018


#43421: The $capabilities argument in the `add_role()` function is incompatible
with `user_can`
-----------------------------+------------------------------
 Reporter:  eclev91          |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Role/Capability  |     Version:  4.9.4
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by eclev91):

 The way around this is to format your capabilities when using `add_role`
 like so:

 {{{#!php
 <?php
 $userCaps = [
   'read' => true,
   'my_cap' => true,
 ];
 }}}

 I really feel like it should support a generic array with true being
 assumed.

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


More information about the wp-trac mailing list