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.php on every page load.

  • Reduces missed schedules for posts, backups, and plugin tasks.

 

Step 1: Disable the Virtual Cron

  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.

 

Step 2: Configure a Real Cron Job

Method A: Using cPanel

  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:

    Bash
    
    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.

Method B: Using the Command Line

  1. Log in via SSH.

  2. At the command prompt, type:

    Bash
    
    crontab -e
    

     

  3. 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.

  4. Save and exit.

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

Notes

  • Always back up your site before editing configuration files.

  • Use a 30‑minute interval for most sites; shorter intervals may increase server load.

  • If WordPress is installed in a subdirectory, adjust the cd path accordingly.

?האם התשובה שקיבלתם הייתה מועילה 0 משתמשים שמצאו מאמר זה מועיל (0 הצבעות)

Powered by WHMCompleteSolution