Execute function only for specific user roles

You can exclude certain roles like this: 1- Create a function to check if the current user role is excluded: function isPasswordValidationSkipped() { // Fill this array with roles that you want to exclude from password validation $excludedRoles = [‘subscriber’]; $user = wp_get_current_user(); foreach ($user->roles as $role) { if(in_array($role, $excludedRoles)) { return true; } } … Read more