不幸的是,toscho的答案不起作用——至少在Wordpress 3.4及以上版本中不起作用。
正确的解决方案如下:
#
# For this, see: wp-includes/capabilities.php > map_meta_cap()
#
function wpse_6533_map_unrestricted_upload_filter($caps, $cap) {
if ($cap == \'unfiltered_upload\') {
$caps = array();
$caps[] = $cap;
}
return $caps;
}
add_filter(\'map_meta_cap\', \'wpse_6533_map_unrestricted_upload_filter\', 0, 2);