Boost Performance: Deactivate WP-Cron (wp-cron.php) Print

  • 2

Disabling the WP-Cron (wp-cron.php) can help improve your WordPress site's performance, especially on high-traffic websites. WP-Cron is responsible for managing scheduled tasks in WordPress, such as publishing scheduled posts, checking for updates, and running recurring tasks. However, it's triggered every time a visitor loads a page on your website, which can lead to performance issues.

To disable WP-Cron and replace it with a manual or real cron job, follow these steps:

  1. Disable WP-Cron in wp-config.php:

    • Access your website's files using an FTP client or a file manager in your hosting control panel.
    • Locate the "wp-config.php" file in the root directory of your WordPress installation.
    • Open the file for editing and search for the line that says /* That's all, stop editing! Happy publishing. */.
    • Just before this line, add the following code: define('DISABLE_WP_CRON', true);
    • Save and close the file. This will disable the default WP-Cron behavior.

  2. Set up a real cron job:

    • Log in to your web hosting control panel (e.g., cPanel, Plesk, DirectAdmin, etc.).
    • Look for the "Cron Jobs" or "Scheduled Tasks" section.
    • Create a new cron job with the following settings:
      • Minute: */5 (This means the cron job will run every 5 minutes. You can adjust this value depending on how often you want the tasks to be executed.)
      • Hour: *
      • Day: *
      • Month: *
      • Weekday: *
      • Command: wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1 (Replace "yourdomain.com" with your actual domain name.)
    • Save the cron job.

By completing these steps, you have successfully disabled the default WP-Cron and replaced it with a real cron job. This should help reduce server load and improve your WordPress site's performance. Remember to monitor your site to ensure that scheduled tasks are still being executed as expected.


Was this answer helpful?

« Back