WordPress function, etc to run every day at midnight, I'll need to use system like WordPress cron job to do that. Unix, if you're not familiar, is predecessor to the modern operating systems of Linux and macOS. In short, to avoid complexity WordPress scheduled task gets executed at the end of serving webpage to visitor. WP-Cron is the usual name we call the subsystem of WordPress that maybe runs function or system after normal page load. perhaps like seeing if there's WordPress code update to download and install.. They're using something called WP Cron system, new pages to work.. Also, it's common to feel that your WordPress scheduled tasks are broken.. To make your Unix server's crontab call into WordPress and run any tasks it has scheduled on some regular and computer-controlled interval.. WordPress Cron Job requires something more like the understanding that it'll run about the time, on normal website with average levels of traffic... BTW, there's in WP.org Developer Handbook Hooking WP-Cron Into System Task Scheduler.
Read more