Skip to content

Setting up a WordPress cron job

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.

  • Ensures scheduled tasks run on time, regardless of site traffic.
  • Improves performance by preventing WordPress from running wp-cron.php on every page load.
  • Reduces missed schedules for posts, backups, and plugin tasks.
  1. Log in to cPanel or connect via SSH.

  2. Open the wp-config.php file in your WordPress directory (usually public_html).

  3. Add the following line before:

    /* That's all, stop editing! Happy publishing. */
    Code:
    define('DISABLE_WP_CRON', true);
  4. Save and close the file.

✅ WordPress will no longer run cron jobs automatically on page loads.

  1. Log in to cPanel at ruachost.com.

  2. In the Advanced section, click Cron Jobs.

  3. Under Cron Email, enter an email address to receive notifications (optional).

    • To suppress emails, append >/dev/null 2>&1 to the command.
  4. 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.
  5. In the Command box, enter:

    Terminal window
    cd ${HOME}/public_html; php -q wp-cron.php

    (Modify the path if WordPress is installed in a subdirectory.)

  6. Click Add New Cron Job.

  1. Log in via SSH.

  2. At the command prompt, type:

    Terminal window
    crontab -e
  3. Add a new line:

    Terminal window
    */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.
  4. Save and exit.

✅ The cron job is now active and will run independently of site traffic.