Here is a quick snippet to check whether the user is exists or not by user_id in WordPress.

$user = get_userdata( $user_id );
if ( $user === false ) 
{
    // The user doesn't exist
}
else 
{
    // The user exists
}

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *