Skip to content

Instantly share code, notes, and snippets.

@nczz
Created June 4, 2019 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nczz/d5675f2b91e8a530cc3bd2c61e5e4ccb to your computer and use it in GitHub Desktop.
Save nczz/d5675f2b91e8a530cc3bd2c61e5e4ccb to your computer and use it in GitHub Desktop.
[WooCommerce] 商店管理員無法編輯隱私權政策頁面
<?php
function add_privacy_page_edit_cap($caps, $cap, $user_id, $args) {
if ('manage_privacy_options' === $cap) {
$manage_name = is_multisite() ? 'manage_network' : 'manage_options';
$caps = array_diff($caps, [$manage_name]);
}
return $caps;
}
add_filter('map_meta_cap', 'add_privacy_page_edit_cap', 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment