If you’re running a WordPress website, you may have noticed that your site uses a feature called WP-Cron to handle scheduled tasks like publishing posts, checking for updates, and running backups. However, WP-Cron can sometimes cause performance issues on your site, especially if you have a high volume of scheduled tasks.
To address this issue, you can disable WP-Cron and instead use a real cron job to handle scheduled tasks. A cron job is a time-based scheduler that can run automated tasks at specific intervals.
Here’s how to disable WP-Cron and set up a real cron job:
Step 1: Edit your wp-config.php file
To disable WP-Cron, you’ll need to add a line of code to your wp-config.php file. This file is located in the root directory of your WordPress installation.
To access the file, you can use an FTP client or access your site’s file manager through your MadPopo hosting control panel. Then, open the wp-config.php file in a text editor and add the following line of code:
define('DISABLE_WP_CRON', true);
Save the changes to the file and upload it back to your site.
Step 2: Set up a real cron job
Once WP-Cron is disabled, you’ll need to set up a real cron job to handle scheduled tasks on your site.
To do this, you’ll need to log in to your hosting control panel and find the Cron Jobs section. From there, you can set up a new cron job with the following command:
wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Replace “example.com” with your site’s URL, and make sure to include the https:// or http:// prefix.
Set the frequency of the cron job according to your needs, and save the changes.
That’s it! By disabling WP-Cron and setting up a real cron job, you can improve the performance of your WordPress site and ensure that scheduled tasks are handled reliably and efficiently.