map_meta_cap filter allows you to modify which primitive capabilities are mapped to which meta capabilities. That is to say, allow a specific user or users to have or not have a capability in a specific context.
map_meta_cap accepts 4 arguments:
$capsAn array of primitive capabilities matched to the provided meta
$capThe name of the meta capability to map to
$user_idThe current user’s id or a specified one
$argsAn array of extra arguments for the meta capability. Sometimes empty
Let’s say you only want to allow super admins to upload files in your Multisite installation (for some reason). The following returns
do_not_allow for any non-super admin on the
View the code example on Gist.Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!