Cron is a standard Unix-like/Linux utility, and it is quite possibly the most valuable highlights which plan content or order to be executed consequently at a predefined date and time. The booked orders, contents, and undertakings are called Cron Jobs. This element was acquainted with mechanizing the cycle of monotonous undertakings.
What is WP-Cron
WordPress utilizes a record called wp-cron.php as a virtual cron work or planned errand to computerize things like distributing booked posts, checking for module or topic refreshes, sending email warnings, and then some.
In WordPress, this is taken care of by WP-Cron, which is utilized to reenact a framework cron. Notwithstanding, contingent upon the measure of traffic to your site, on low traffic locales this is completely fine, yet when your web page visits begin to increment, checking on numerous occasions for booked errands can be extremely wasteful and lead to asset use issues for the worker, this will thus make your site load more slowly. So doing this will free up a lot of resources and make your wordpress site load faster.
How to disable wp-cron in WordPress
wp-cron job is used for keep your website running smoothly. Cron job is a job scheduler. it is used for check software updates, schedule posting, send trackback pings etc
if cron job not running properly important background tasks will not run. it could find that your WordPress installation is out of date and full of security vulnerabilities.
WordPress has a built in script >> wp-cron.php. wp-cron.php runs only when HTTP requests to the server someone visits your blog the server spawns a process to run cron jobs.
If the blog is new, and nobody comes to visit the site? Well. the cron jobs will not run automatically which could lead to problems over time.
If blog is established and gets a lot of visitors then each wp-cron.php spawns a process on your server, it could lead to excess server load and ultimately waste your server resources.
Instructions to Disable WP-Cron
Disable WordPress Cron
Before we setup the WordPress cron job in our Linux server, you should disable internal WordPress cron job Process. Add one line to your wp-config.php
Open wp-config.php file
Insert the code after the <?php tag at the beginning of the file
define(‘DISABLE_WP_CRON’, true); >> simply change the word false to true
Install Cron on Your Server
#sudo apt-get update
#sudo apt-get install cron >> install cron
it will be asked if you sure you want to install cron, type Y and hit Enter to continue
#Add the WordPress Cron Job to Linux Server
we can add the WordPress cron job in our Linux Server
*/15 * * * * cd /var/www/html; php /var/www/html/wp-cron.php > /dev/null 2>&1
add the above line to crontab.
Replace /var/www/html with the correct path to the wp-cron.php. This command will run WordPress cron job once every 15 minutes. save and exit
After save cron job it should automatically begin processing the background tasks on a regular basis, without creating an unnecessary drain on server resources