Created
January 5, 2021 14:18
-
-
Save ouun/1dfd204081558c4f375c3476fdb6dc38 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Customize caps to edit Privacy Page | |
*/ | |
add_action('map_meta_cap', function ($caps, $cap, $user_id, $args) { | |
$user_meta = get_userdata($user_id); | |
if ($user_meta) { | |
if (array_intersect(['shop_manager', 'administrator'], $user_meta->roles)) { | |
if ('manage_privacy_options' === $cap) { | |
$manage_name = is_multisite() ? 'manage_network' : 'manage_options'; | |
$caps = array_diff($caps, [$manage_name]); | |
} | |
} | |
} | |
return $caps; | |
}, 1, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment