Disable WP-Cron for faster performance
Introduction
CRON jobs are used in WordPress to execute scheduled tasks at specific times, dates or intervals. Examples of WordPress cron jobs are scheduled publishing of posts, checking for updates or running a backup plugin according to a predefined schedule.
This task is handled by WP-Cron in WordPress, which is used to simulate the functionality of a system cron job. However, it's important to note that using the built-in cron handler can actually affect your website load times, depending on your website traffic. Therefore, today we would like to show you how to disable WP-Cron (wp-cron.php) in order to use a system cron instead and thus improve performance.
Problems with WP-Cron performance
At ORC Web Hosting, we maintain many high-traffic and demanding websites. As a result, we've noticed performance issues with WordPress' built-in cron handler, WP-Cron. It is crucial to understand that WP-Cron does not run continuously like a real cron job. By default, wp-cron.php is activated on every page load, which can cause problems on high-traffic websites. If a website does not have enough PHP workers, requests may trigger the cron, but it has to wait for workers to become available and thus stops.
The opposite can also happen: If there is little traffic on a website, scheduled tasks may be missed because no one is viewing the page.
A better solution is to disable WP-Cron and use a system cron instead. This works on a predefined schedule and is even recommended in the official plugin manual.
Disable WP-Cron
To disable WP-Cron, simply add the following code just before the line in your wp-config.php file that starts with "That's all, stop editing! Happy blogging." Note that this will prevent WP-Cron from running when pages load, but not if you call it directly from wp-cron.php.
define ('DISABLE_WP_CRON', true);

To set up a system cron
The next step is to schedule wp-cron.php on your server.
Creating a cron job in cPanel
Since we are using cPanel, you can easily create a system cron from the cPanel dashboard. Please make sure you disable the default WP cron described above first.
Step 1
Log in to your cPanel account. Go to the Advanced section and click Cron Jobs.

Step 2
In the "Add a new cron job" section, you can choose from various predefined schedules, such as every hour or once a week, and so on.

Step 3
Add the following command. Replace "https://meine-domain.ch" by your own domain name. Note that this command may vary slightly depending on your hosting provider's configurations. After that, click "Add new cron job".
wget -q -O - https://meine-domain.ch/wp-cron.php?doing_wp_cron >/dev/null 2>&1

The >/dev/null 2>&1 part of the above command disables email notifications.
Congratulations! You've now learned how to disable WP-Cron to boost the performance of your WordPress website. By switching to a system cron, you'll ensure that your scheduled tasks run smoothly and efficiently. Your WordPress website management has never been so simple and powerful!