About Cron:-
A cron job is a task that can automatically run or schedule to run at some specific intervals.Say if you need to take backup for periodically than you will run the cron job.
In its default config, WordPress does not use a real cron job for scheduling and other related tasks.
Instead, whenever a page is loaded on a WordPress site, WordPress runs the wp-cron.php file.
Drawbacks of wp-cron.php to run cron job:-
while we run the wp-cron.php every time the word press loads a page it is unnecessary due to this it will affect the server performance,in the sites it will receive a lot of traffic.
To resolve these issues, you can disable the default virtual WordPress cron job, and configure a real cron job
Steps to disable the wp-cron.php:-
To disable the default virtual WordPress cron job, follow the below steps,
1.open the wp-config.php file via file manager or ftp.
2. Edit the file
3.Identify the following line:
/** The Database Collate type. Don’t change this if in doubt. */
define(‘DB_COLLATE’, ”);
/** The Database Collate type. Don’t change this if in doubt. */ define(‘DB_COLLATE’, ”);
4. Next add the following script
define('DISABLE_WP_CRON', 'true');
/** The Database Collate type. Don’t change this if in doubt. */ define(‘DB_COLLATE’, ”); define('DISABLE_WP_CRON', 'true');
5. save all the above changes.
Setup cron job for wp-cron.php manually
Step 1. Access cronjob through cPanel or SSH.
Step 2. For cPanel, click the drop-down menu for Common Settings and select once per hour.
Step 3. Enter the following command in the Command field:
cd /home/cpanelusername/public_html; php -q wp-cron.php
Step 4. Click Add New Cron Job button.
Step 5. The cron job is now added in your cPanel.
Thats all! i think this post will helpfull for you.