WP-Cron not running: setup a real cron on cPanel & Plesk
WordPress relies on WP-Cron to handle scheduled tasks like publishing scheduled posts, checking for updates, and sending email notifications. However, WP-Cron depends on site traffic to trigger these tasks, which can cause delays or failures on low-traffic sites. The quick fix is to disable WP-Cron’s default behavior and set up a real server cron job via cPanel or Plesk to run WP-Cron reliably.
Quick Fix
- Disable WP-Cron’s automatic execution by adding
define('DISABLE_WP_CRON', true);
towp-config.php
. - Create a cron job in cPanel or Plesk to run the WP-Cron PHP script every 5 or 10 minutes.
- Verify the cron job runs successfully and scheduled tasks execute on time.
Why this happens
By default, WP-Cron runs when someone visits your WordPress site. If your site has low or irregular traffic, scheduled tasks may not run on time or at all. This can affect publishing scheduled posts, plugin updates, backups, and other time-sensitive operations. Using a real server cron job ensures WP-Cron runs at fixed intervals regardless of site traffic.
Step-by-step: Setup a real cron on cPanel & Plesk
1. Disable WP-Cron automatic execution
Edit your WordPress wp-config.php
file located in the root directory of your WordPress installation. Add the following line above the /* That's all, stop editing! Happy blogging. */
comment:
define('DISABLE_WP_CRON', true);
This prevents WP-Cron from running on every page load.
2. Find the correct PHP executable path
You need to know the path to the PHP binary on your server. Common paths include:
/usr/bin/php
/usr/local/bin/php
/opt/cpanel/ea-php74/root/usr/bin/php
(for cPanel with EasyApache 4)
If unsure, contact your hosting provider or run which php
via SSH.
3. Create the cron job in cPanel
- Log in to your cPanel dashboard.
- Navigate to Cron Jobs under the Advanced section.
- Under Add New Cron Job, select the interval (e.g., every 5 minutes:
*/5 * * * *
). - In the command field, enter the following command, replacing
/path/to/php
and/home/username/public_html
with your server’s PHP path and WordPress root directory:
/path/to/php /home/username/public_html/wp-cron.php > /dev/null 2>&1
The > /dev/null 2>&1
part discards output to avoid email spam.
- Click Add New Cron Job to save.
4. Create the cron job in Plesk
- Log in to your Plesk control panel.
- Go to Tools & Settings > Scheduled Tasks.
- Click Add Task.
- Set the task type to Run a command.
- Set the schedule (e.g., every 5 minutes).
- Enter the command, replacing paths accordingly:
/path/to/php /var/www/vhosts/example.com/httpdocs/wp-cron.php > /dev/null 2>&1
- Save the task.
5. Verify the cron job runs
Check your scheduled posts or plugin tasks to confirm they execute on time. You can also check cron logs or enable debugging in WordPress to monitor WP-Cron activity.
Works on
Environment | Supported |
---|---|
cPanel (with EasyApache 4) | Yes |
Plesk Onyx and later | Yes |
Apache Web Server | Yes |
Nginx Web Server | Yes |
LiteSpeed Web Server | Yes |
FAQ
-
Q: Can I set the cron job to run less frequently than every 5 minutes?
A: Yes, you can adjust the interval to every 10, 15, or 30 minutes depending on your needs. However, running every 5 minutes is recommended for timely task execution.
-
Q: What if I don’t have SSH access to find the PHP path?
A: Contact your hosting provider for the correct PHP binary path or check your hosting documentation. Many hosts provide this information in the control panel.
-
Q: Will disabling WP-Cron affect my site negatively?
A: No, disabling WP-Cron’s automatic execution only stops it from running on page loads. The real cron job you set up will run WP-Cron reliably instead.
-
Q: How do I troubleshoot if the cron job doesn’t seem to run?
A: Check the cron job logs, verify PHP path and permissions, and ensure the command syntax is correct. Also, confirm
DISABLE_WP_CRON
is set properly inwp-config.php
. -
Q: Can I use a plugin to manage WP-Cron instead?
A: Some plugins help monitor or trigger WP-Cron, but they still rely on traffic or server cron jobs. Setting up a real cron job is the most reliable method.