Last active
June 19, 2020 15:06
-
-
Save Cafnio/ec19785805ba10ec6ba0df9fb745fb74 to your computer and use it in GitHub Desktop.
WooCommerce: Deny Automatic Login Upon Registration (Specific Roles)
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 the following content to functions.php | |
function filter_woocommerce_registration_auth_new_customer( $true, $newWserId ) { | |
$roles = get_userdata( $newWserId )->roles; | |
if ( !in_array( 'customer', $roles )) { | |
return false; | |
} | |
return $true; | |
}; | |
// add the filter | |
add_filter( 'woocommerce_registration_auth_new_customer', 'filter_woocommerce_registration_auth_new_customer', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment