WordPress uses a built‑in “virtual cron” system to schedule tasks such as publishing posts, checking for updates, and running plugin jobs. By default, this system relies on site traffic to trigger tasks, which can cause delays or performance issues. On ruachost.com, you can disable the virtual cron and configure a real server‑level cron job for reliability.
Why Set Up a Real Cron Job?
-
Ensures scheduled tasks run on time, regardless of site traffic.
-
Improves performance by preventing WordPress from running
wp-cron.phpon every page load. -
Reduces missed schedules for posts, backups, and plugin tasks.
Step 1: Disable the Virtual Cron
-
Log in to cPanel or connect via SSH.
-
Open the
wp-config.phpfile in your WordPress directory (usuallypublic_html). -
Add the following line before:
/* That's all, stop editing! Happy publishing. */Code:define('DISABLE_WP_CRON', true); -
Save and close the file.
✅ WordPress will no longer run cron jobs automatically on page loads.
Step 2: Configure a Real Cron Job
Method A: Using cPanel
-
Log in to cPanel at ruachost.com.
-
In the Advanced section, click Cron Jobs.
-
Under Cron Email, enter an email address to receive notifications (optional).
-
To suppress emails, append
>/dev/null 2>&1to the command.
-
-
Under Add New Cron Job, select an interval (e.g., Twice an hour).
-
Shared accounts allow a minimum of 15 minutes.
-
A 30‑minute interval is usually sufficient.
-
-
In the Command box, enter:
Bash cd ${HOME}/public_html; php -q wp-cron.php(Modify the path if WordPress is installed in a subdirectory.)
-
Click Add New Cron Job.
Method B: Using the Command Line
-
Log in via SSH.
-
At the command prompt, type:
Bash crontab -e -
Add a new line:
Bash */30 * * * * cd ${HOME}/public_html; php -q wp-cron.php-
This runs the cron job every 30 minutes.
-
On unmanaged servers, you can set shorter intervals.
-
-
Save and exit.
✅ The cron job is now active and will run independently of site traffic.
Notes
|