How to Disable Wp-Cron and Replace It with A Real Cron Job
The process to Deactivate Wp-Cron and Substitute It with A Real Cron Job
WordPress utilizes a workaround file called wp-cron.php as a virtual cron job or scheduled task for automating various actions such as publishing scheduled posts, checking for updates of WordPress plugins and themes, sending email notifications, and more. Every time someone loads your WordPress website, WordPress makes a call to wp-cron.php. It checks if there are any scheduled tasks to be performed and executes them if necessary.
In certain situations, the wp-cron.php file may become a target of DDOS attacks or cause conflicts with caching plugins, leading to high server load or improper execution of scheduled tasks. Consequently, it is important to disable wp-cron.php and replace it with a real cron job.
Linux Cron Job vs WP-Cron
Linux cron jobs can be managed by the user, allowing you to run scheduled tasks on your web server. It is particularly useful for high-traffic WordPress websites as the Linux cron job can help reduce downtime by minimizing server bandwidth and conserving server resources.
Instead, wp-cron.php functions as a virtual cron job that only operates when a page is loaded. When a website page is requested on the front end or backend, wp-cron is initially loaded by WordPress, which then triggers the necessary tasks for the visitor.
To disable wp-cron, you need to modify the wp-config.php file located in the WordPress installation folder. Open the wp-config file and add the following code:
Setting Up an Actual Cron Job
1) Log in to cPanel.
2) Go to “Cron Jobs” under the “Advanced” section.
3) Add the following command to be executed every 30 minutes:
wget -q -O – http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Replace yourdomain.com with your actual website name.
4) Click the “Add New Cron Job” button.
If you require further assistance, please contact our support department.
cPanel / WHM
- Show all articles ( 83 ) Collapse Articles
- Show all articles ( 25 ) Collapse Articles
- Show all articles ( 140 ) Collapse Articles
- Articles coming soon
- Show all articles ( 22 ) Collapse Articles
- Show all articles ( 37 ) Collapse Articles