This article explains how to substitute WP-cron with a Linux cron job. To maximize the effectiveness of your WordPress cron jobs, turn off WP-cron and create a regular cron job that runs automatically every hour using cPanel.
Follow the steps:
- Disable WP-Cron in WordPress: Add “define(‘DISABLE_WP_CRON’, true);” to your “wp-config.php” file.
- Access Your Server: Use SSH or your hosting control panel to access your server.
- Open Crontab: Enter “crontab -e” to edit your crontab file.
- Add Cron Job: Add a new line with the following syntax: “*/15 * * * * /usr/bin/php /path/to/your/site/wp-cron.php > /dev/null 2>&1” (adjust the path to “wp-cron.php” and the PHP binary as needed).
- Save and exit: Save the changes and exit the editor.
- Verify Cron Job: Check that the cron job is registered by running “crontab -l.”
- Test: Confirm that scheduled tasks are running as anticipated by checking your WordPress site’s scheduled events.
This way, you can substitute WP-cron with a Linux cron job. For further help, reach out to our support team.