how can I call a function when time expire
I have this function but the function name is user_profile_update_errors. so it does not work without press Edit button in user edit page. Which should I use function for it?
access levels are deleted if the date entered is greater than today's date.
add_action( 'user_profile_update_errors', 'crf_user_profile_update_errors', 10, 3 );
function crf_user_profile_update_errors($errors, $update, $user ) {
$current_date = date(Y-m-d);
$date_to_compare = $_POST['year_of_birth'];
if ( ! $update ) {
    return;
}
            //Bugünün Tarihi//            //Girilen Tarih//
if (strtotime($current_date  strtotime($date_to_compare)) ) {
    $user_levels = rua_get_user($user)-get_level_ids(false, false, true);
    foreach ($user_levels as $level) {
            rua_get_user($user)-remove_level($level);
        }
}}