How to easily Schedule Cron Job in WordPress
In Windows
1) Create new powershell executable (.ps1)
2) Add command(s) to be executed (eg. at C:\HostingSpace\Prot\WordpressChron.ps1)
Add define
('DISABLE_WP_CRON', 'true');
to wp-config above
if (!defined('ABSPATH'))
Create new task in task scheduler to run the .ps1 file
In Linux
1. We execute commands as root with:
sudo su
2. We create a new cron file for the commands we want to schedule
crontab -e 0 */6 * * * wget "https://www.test.com/wp-cron.php"
3. Restart cron service
sudo service cron restart
4. Check that locale timezone is ok
For more Info about wordpress cron check here
For Crontab in UbuntuĀ here
Nice article,
Thank you!