Skip to content

Instantly share code, notes, and snippets.

@parsakafi
Created October 31, 2017 22:25
Show Gist options
  • Save parsakafi/89f285c6ac5ba86b5baa88b0bfef29c2 to your computer and use it in GitHub Desktop.
Save parsakafi/89f285c6ac5ba86b5baa88b0bfef29c2 to your computer and use it in GitHub Desktop.
WordPress current_user_can set array capability
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