Check If a User Has Ever Logged In
For existing users, you’ll need to look at these clues: Option A: Use user_registered Date
If they never logged in, their user_registered date will exist, but you’ll find no login activity.
$users = get_users( array(
'meta_key' => '_last_login',
'meta_compare' => 'NOT EXISTS',
) );
foreach ( $users as $user ) {
echo $user->user_login . ' has never logged in.<br>';
}
Thanks
Ahir Hemant
last_login_time was never part of WordPress I think: https://github.com/search?q=repo%3AWordPress%2FWordPress%20last_login_time&type=code
You can only find out if and when a user was logged in with additional plugins. There is, for example, this proverbially suitable plugin: https://wordpress.org/plugins/when-last-login/ – of course, this only works for users from the time you install and activate the plugin. There is no chance for the time before that.
However, there are certainly other methods to achieve your own goal of combating spam subscriptions. There are numerous plugins for this: https://de.wordpress.org/plugins/tags/spam-protection/