Created
June 19, 2024 00:01
-
-
Save adrianduffell/b2f3272bbb0ce3ea5af961d6123503d3 to your computer and use it in GitHub Desktop.
Exclude user role from coming soon protection
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( ‘woocommerce_coming_soon_exclude’, function( $is_excluded ) { | |
$current_user = wp_get_current_user(); | |
$role_to_exclude = ‘name_of_role’; | |
if ( in_array( $role_to_exclude, (array) $current_user->roles ) ) { | |
return true; | |
} | |
return $is_excluded; | |
}, 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment