Created
October 31, 2017 22:25
-
-
Save parsakafi/89f285c6ac5ba86b5baa88b0bfef29c2 to your computer and use it in GitHub Desktop.
WordPress current_user_can set array capability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function current_user_can_vy($caps, $all_capability = false) | |
{ | |
if (is_array($caps)) { | |
foreach ($caps as $cap) { | |
$capability = current_user_can($cap); | |
if (!$all_capability && $capability) | |
return true; | |
elseif ($all_capability && !$capability) | |
return false; | |
} | |
if ($all_capability) | |
return true; | |
else | |
return false; | |
} else | |
return current_user_can($caps); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment