<?php
function func_get_args_in_current_user_can( $capability ) {
$args = array_slice( func_get_args(), 1 );
$args = array_merge( array( $capability ), $args );
var_dump($args);
}
function func_get_args_simplified( $capability ) {
$args = func_get_args();
var_dump($args);
}
// Passing 1 arg.
func_get_args_in_current_user_can( 'edit_posts' );
func_get_args_simplified( 'edit_posts' );
// Passing 2 args.
func_get_args_in_current_user_can( 'edit_post', 10 );
func_get_args_simplified( 'edit_post', 10 );
// Passing 3 args.
func_get_args_in_current_user_can( 'edit_post_meta', 10, 'meta_key' );
func_get_args_simplified( 'edit_post_meta', 10, 'meta_key' );
- Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
- array(1) {
[0]=>
string(10) "edit_posts"
}
array(1) {
[0]=>
string(10) "edit_posts"
}
array(2) {
[0]=>
string(9) "edit_post"
[1]=>
int(10)
}
array(2) {
[0]=>
string(9) "edit_post"
[1]=>
int(10)
}
array(3) {
[0]=>
string(14) "edit_post_meta"
[1]=>
int(10)
[2]=>
string(8) "meta_key"
}
array(3) {
[0]=>
string(14) "edit_post_meta"
[1]=>
int(10)
[2]=>
string(8) "meta_key"
}
preferences:
91.6 ms | 408 KiB | 5 Q