Created
August 16, 2023 11:57
-
-
Save ibrahim-kardi/34e162e5e3732d6451f25dafb6390367 to your computer and use it in GitHub Desktop.
Capability
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
add_filter( | |
'user_has_cap', | |
function( $allcaps, $caps, $args, WP_User $user ) { | |
$current_user = wp_get_current_user(); | |
$requested_cap = $args[0]; | |
if ( $user->ID === $current_user->ID && in_array( 'customer', (array) $current_user->roles ) ) { | |
if ( 'upload_files' === $requested_cap ) { | |
return $allcaps; | |
} | |
} | |
return $allcaps; | |
}, | |
10, | |
4 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment