Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #43421, comment 2


Ignore:
Timestamp:
03/10/2018 05:39:57 PM (6 years ago)
Author:
soulseekah
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #43421, comment 2

    initial v1  
    1212}}}
    1313
     14and the Codex examples show this, too: https://codex.wordpress.org/Function_Reference/add_role#Example
     15
    1416You have to pass both these things. When you pass `$userCaps = [ 'read', 'my_cap', ];` you are effectively passing in the following array: `[ 0 => 'read', 1 => 'my_cap' ]`, which in turn tries to perform two calls: `add_cap( 0, 'read' )` and `add_cap( 1, 'my_cap' )`, which is, indeed, incompatible with what you're trying to achieve.
    1517