How To Disable WP-Cron.php Print

  • 0

The wp-cron procedure is the topic of one of the most common WordPress support questions. WP-Cron controls all of your WordPress website's scheduled events. It is a typical source of excessive CPU loads and memory usage, particularly for websites with huge databases and/or traffic. By default, WordPress is configured to call the wp-cron.php file whenever your website is visited. This is OK for the majority of websites, but when you begin to get a significant amount of traffic, it may begin to stack up the processes and negatively impact the overall speed of your website.

 

How to disable wp-cron.php

Thankfully it’s very easy to disable wp-cron.php by just adding a line of code to your configuration file:

  1. Navigate to wp-config.php file where you have installed WordPress
  2. Open it up in file manager or your favorite text editor
  3. Add the following: define(‘DISABLE_WP_CRON’, true);
  4. Save the file and re-upload.

Now WordPress will no longer automatically run this file when a visitor accesses your website.

 

Setup wp-cron.php to run manually

Disabling wp-cron.php is going to free up a lot of that CPU/memory usage, but you still need to have it run so WordPress will have the ability to automate any tasks it needs to carry out.

To do this we just need to setup a cronjob inside of cPanel to execute the file:

  1. Login to cPanel and navigate to Cron Jobs
  2. Add a new cron job to run once an hour with the following command: wget https://www.yourwebsite.com/wp-cron.php > /dev/null 2>&1
  3. Make sure to replace yourwebsite.com with the correct URL to your wp-cron.php file.
  4. Click Add New Cron Job

You’re then all set! WP-Cron will only run once an hour and not when every time someone visits your website.

If you have any questions on this or would like our team to set it up for you, feel free to reach out!

 
 

Was this answer helpful?

« Back