Created
May 22, 2018 11:48
-
-
Save bappi-d-great/011426ec4aaa856c2f4cb9d137780f8b to your computer and use it in GitHub Desktop.
Allow Subsite admin to access new privacy menu by default
This file contains hidden or 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 | |
add_filter( 'map_meta_cap', function( $caps, $cap, $user_id, $args ) { | |
switch( $cap ) | |
{ | |
case 'export_others_personal_data': | |
case 'erase_others_personal_data': | |
case 'manage_privacy_options': | |
if( ( $key = array_search( 'manage_network', $caps ) ) !== false ) { | |
unset( $caps[$key] ); | |
} | |
$caps[] = 'manage_options'; | |
break; | |
default: | |
$caps = $caps; | |
} | |
return $caps; | |
}, 99, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment