#41200 closed defect (bug) (duplicate)
Documentation outdated for current_user_can()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.0 |
Component: | Users | Keywords: | |
Focuses: | docs | Cc: |
Description
https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/capabilities.php#L538
Doc says the function takes two parameters, but the source code allows for only one.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hey there,
Welcome to Trac!
The function actually takes one ore two arguments, see https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/capabilities.php#L544:
$args = array_slice( func_get_args(), 2 );
.func_get_args()
returns everything you pass to the function (could be dozens of args), and thearray_slice()
call limits it to three.I understand it can be a bit misleading though because the
func_get_args()
call is not obvious at first glance. It's probably been like this since the introduction of the function, so doing things like actually adding the parameters could perhaps break some things.I'm therefore closing this ticket but if you feel like this should be handled differently, let us know.