add_action('wp_login', 'myfunc');
function myfunc() {
$user_meta = get_userdata($user_id);
$user_roles = $user_meta->roles;
if (in_array("administartor", $user_roles)){
//run a code
}
}
i use this one but my login page is breaking Down and all login tries got failed message.
I guess the problem is in wp_login hook