Wordpress uses a file called wp-cron.php as a virtual cron job, a task that is scheduled in order to automate things such as publishing posts,
checking for updates to the theme or a set of plugins, notifyings users via email and much much more

By Default Wordpress is configured to summon wp-cron.php every single time a person visits your wordpress powered website when a scheduled task exists,
to basically ask "do I do anything yet? What time? How about now?" On sites that have very low traffic this is quite normal but as your traffic begins to spike and settle at a higher rate,
checking multiple times for tasks that are scheduled can be extremely inefficient and cause excess resourse usage on your server,
on top of that your entire website would be much slower to access.

Disable Default WP-CRON.php Behavior

We can simply tell wordpress to let us handle the execution of wp-cron.php with the wp.config file.
First step: Open your wp-config.php file with the cPanel code editor Second step: Go to the bottom of the database settings, most commonly around line 37

Add the following code: define('DISABLE_WP_CRON', 'true'); Final step: Save it

Now that we have finished that, wordpress will not autorun the wp-cron.php script each time your site gets a new user/visitor

Setup Manual Cron Job for WP-CRON.php

We really don't want to leave wordpress running without any ability to automate tasks that it might need to do.
But at the very least now that its not running for every single visitor, we can have alot more control over the tasks that take place.
For alot of the wordpress users having wp-cron.php script run every 5-6 hours if perfectly fine. That would be a total of 4 executions daily,
compared to hundreds and thousands if you had alot of traffic on that particular day.

Step 1: Login into cPanel
Step 2: Underneath the advanced section, select Cron jobs.
Step 3: Select once an hour from the common settings drop down.
Step 4: Now select every 5 or 6 hours from the hour drop down menu.
Step 5: Finally fill the code to run our cron job and click add new cron job.
cd /home/userna5/public_html; php -q wp-cron.php


Step 6: You should see a success messege that your new cron job has been added successfully

Was this answer helpful? 99 Users Found This Useful (120 Votes)