Skip to content
xYnta
Go to websitexynta.com
Search
EN

Disabling wp-cron.php for better performance

Updated on

WordPress runs scheduled tasks through the wp-cron.php file, and it does so on every visit to your website. On a small website you will hardly notice this, but with many visitors the file is called very often and your website can slow down. You therefore switch off this call on every visit and let a cron job run the tasks at fixed times instead.

Web Hosting (DirectAdmin)

Also for Reseller Hosting.

Note: a mistake in wp-config.php can make your website unreachable. First make a copy of the file or create your own backup.

  1. Open the wp-config.php file in the folder of your WordPress website, for example via File Manager in DirectAdmin (see Managing files). If WordPress is in the root of your domain, that is domains/yourdomain.nl/public_html/wp-config.php.
  2. Directly before the line /* That's all, stop editing! Happy publishing. */, add the line define('DISABLE_WP_CRON', true);.
  3. Save the file.
  4. In DirectAdmin, create a cron job that runs every 15 minutes (*/15 for the minute, * for the other fields), with this command: wget -q -O - "https://yourdomain.nl/wp-cron.php?doing_wp_cron" >/dev/null 2>&1. If WordPress is in a folder, add that folder to the address: https://yourdomain.nl/<folder>/wp-cron.php?doing_wp_cron. How to create a cron job is explained in Setting up a cron job on your hosting package.

WordPress Hosting (Plesk)

  1. Log in to Plesk at https://whs1.srvnl.nl:8443. You can find your server name in How can I find the server name of my hosting package?
  2. Click WordPress in the menu on the left.
  3. For your website, under Performance, switch on Take over wp-cron.php.

WP Toolkit then creates a scheduled task of its own that runs wp-cron.php every 5 minutes. You can see that task under Websites & Domains › Scheduled Tasks. You do not need to change wp-config.php yourself here.

wp-cron.php then no longer runs on every visit, but as a scheduled task in the background.

Related articles