[wp-trac] [WordPress Trac] #41200: Documentation outdated for current_user_can()

WordPress Trac noreply at wordpress.org
Thu Jun 29 10:08:46 UTC 2017


#41200: Documentation outdated for current_user_can()
--------------------------+----------------------
 Reporter:  kluny         |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Comments      |     Version:  2.0
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by swissspidy):

 * status:  new => closed
 * version:  trunk => 2.0
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 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 the `array_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.

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


More information about the wp-trac mailing list