WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more.

By default WordPress is setup to call wp-cron.php everytime someone visits your WordPress website, to basically ask "do I have anything to do?"

On low traffic sites this is typically perfectly fine, but when visitors start to roll in, checking multiple times to see if it's time to do anything yet can be very inefficient and lead to resource usage problems for your server, plus make your website load slower.

Disable default wp-cron.php behavior

We can easily tell WordPress to let us handle the execution of wp-cron.php with the wp-config.php file.

  1. Open your wp-config.php file with the cPanel File Manager Code Editor
  2. Now we'll disable the cron by going to the bottom of the database settings in wp-config.php typically found around line 37.

    Add the code below highlighted in red:

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    define('DISABLE_WP_CRON', 'true');
  3. Click Save

Now WordPress will not automatically run the wp-cron.php script each time your site gets a new visitor.

Setup manual cron job for wp-cron.php

We don't want to leave WordPress without any ability to automate tasks it might need to do. But at least now that it's not running for every single visitor, we can have way more control over when these tasks take place.

For most WordPress users having the wp-cron.php script run every 6 hours is perfectly fine. That would be just 4 executions in a day, compared to possibly hundreds, or even thousands if you had a lot of website traffic that day.

  1. Log into cPanel
  2. click on cron jobsUnder the Advanced section, click on Cron Jobs.
  3. select once an hour from common settingsSelect Once an hour from the Common Settings drop-down.
  4. select every 6 hours from hour fieldNow select Every 6 hours from the Hour drop-down.
  5. fill in cron job command click add new cron jobFinally fill in the code to run our cron job and click Add New Cron Job.
    cd /home/userna5/public_html; php -q wp-cron.php

    Where userna5 is your cPanel user name.

    Also keep in mind that the /home/userna5/public_html path would be for a primary domain, if you're using an addon domain, or have WordPress installed in a sub-directory you'll want to be sure to update your path.

  6. added cron job successfullyYou should see that your new cron job was added successfully.

Now your WordPress website should be safely running scheduled tasks via the wp-cron.php script, but only at set intervals to reduce unessary executions of this script. If you are supposed to receive email notifications, but are not, see our helpful guide titled Why is my cron job not emailing me?

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Support Center:
Email Address
Optional, but our team may contact you for more information.
Like this Article?


Post a comment
2013-08-25 9:29 am

cd /home/userna5/public_html; php -q wp-cron.php

userna5 ===> user name CPanel ? or DataBase ? or Wordpress ?
2013-08-26 10:25 am
No one is here?

my website: http://novinbat.com/
Is this true?

wget -q -O - http://novinbat.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
5,603 Points
2013-08-26 4:02 pm
Hello nowadays, and thanks for your comment.

I've gone ahead and updated this article to be a bit more clear. The username for the /home/userna5/public_html path as mentioned now, should be your cPanel username, or the physical path to your WordPress installation on your server.

I've seen the wget method you've mentioned also recommended around the web, but I've also heard people complain if it causing problems for them. So you might want to stick to the sure fire way of directly calling the script locally that is used in this article.

- Jacob
2013-12-08 2:06 pm
Hei Jacob what is the point of setting 1 hour in creative settings that goes off when you select 6 hours from the drop down?
4,112 Points
2013-12-09 11:22 am
The reasoning behind this is to run it every 6 hours, and only one time in that 6 hours period.
n/a Points
2014-04-17 8:48 am

this tip helps a lot with dealing a monster site.


5,603 Points
2014-04-17 12:51 pm
No problem at all laishaoyi, glad it helped out!

Post a Comment

Email Address:
Are you a bot?

Please note: Your name and comment will be displayed, but we will not show your email address.

Write New!
Do you want to publish a tutorial to our support center?

News / Announcements

SSL Certficate Warnings
Updated 2014-04-14 11:34 am EST
Hits: 2219
Heartbleed 0-day OpenSSL security bug
Updated 2014-04-14 04:43 pm EST
Hits: 5641

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!