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 when a scheduled task is present, to basically ask "is it time to do anything yet?".

On low traffic sites this is perfectly fine, but when visitors roll in, checking multiple times for scheduled tasks 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. Go to the bottom of the database settings in wp-config.php typically 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.

    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. If you aren't receiving an email when the cron runs, see our guide on 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 this article:
Email Address

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

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
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
9,968 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
n/a Points
2014-06-03 10:42 pm

Generally it's better to trigger cron from the command line than web because web often has a more limiting max execution time than command line.

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?
8,502 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.


9,968 Points
2014-04-17 12:51 pm
No problem at all laishaoyi, glad it helped out!
n/a Points
2014-04-30 11:22 pm

I have a number of WordPress sites on my IMH account. Is this a "one size fits all" sort of thing? i.e. Will this make all my sites run a chron job at the same time? Most of my sites are in folders (like  public_html/qrs/wordpress2, public_html/xyz/wordpress3, etc ) Is that a problem in any way?

8,502 Points
2014-05-01 7:45 am
This change will only affect the WordPress site that you make the change on and will not affect all other WordPress sites. You will need to make the change on each site if you want it active on all of them.
n/a Points
2014-05-05 10:28 pm

Thanks Jeff!

One further question... If I have a site in a folder and I run "WordPress in a folder" do I want the chron to be set to the root of that site i.e.  ... public_html/xyz or should I set the chron to the actual location of the wp-chron.php file  i.e. ... public_html/xyz/abc

8,502 Points
2014-05-06 7:41 am
The cron should run the wp-cron.php file inside the folder of that specific site. For example, if you have wordpress installed inside a folder names wordpress, you would set the cron to the following:

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

n/a Points
2014-05-06 10:34 am

Hi Jeff,

Sorry to be a pain... But I'm not absolutely sure we are on the same page. If you'll indulge me, I'll see if I can do this more graphically.. I'll use 3 sites in the example but only "flesh out #2 as my poster child. Each site is a separate addon domain.



      wordpress-site-folder-1 (abc.com)

      wordpress-site-folder-2 (mno.com)




      wordpress-site-folder-3 (qrst.com)


So in my example, the path to the actual wp-chron.php would be


But you are saying that the chron job path should go to the site root...


Yes? I just want to be sure to get it right!



8,502 Points
2014-05-06 11:10 am
Your wp-cron.php file is directly inside the WordPress directory for each site, in which there would not be a separate folder inside it with additional WordPress files unless you have some sort of additional custom setup. If you take a look inside each WordPress installation, you will see a file named wp-cron.php. This is the file that needs to be referenced in the cron job for each site.
n/a Points
2014-05-06 11:30 am

Hi Jeff,

OK... It sounds like the correct path is to the location of the actual wp-chron.php file.

I think the misscommunication is about giving WordPress it's own folder - routine for me as it's a small but incremental plus for security.

Here's the wordpress.org skinny on it.


Thanks again!

18,686 Points
2014-05-06 1:07 pm
Hello Ken,

Thanks for the additional information.

Kindest Regards,
Scott M
n/a Points
2014-05-29 8:51 am

My host sent me a message 15 days ago saying that "multiple wp-cron processes running from previous days" had caused a resource shortage on my server. A quick google search led me to your website and I applied the line of code in wp-config.php exactly where you suggested. This morning there is another warning message in my inbox saying the same website's wp cron had caused a resource shortage. I checked wp-config.php and verified that I had entered the code correctly.

Any suggestions why wp cron is still doing this despite that it has been disabled?

8,502 Points
2014-05-29 9:02 am
This line within your wp-config.php file will completely disable the wp-cron. It is, however, possible that if you set up the additional cron job, that you set it to run too frequently.

If you only disabled the wp-cron and are still getting these messages, I recommend speaking with your host for more information as it should no longer be running anymore.
n/a Points
2014-05-29 1:14 pm

I do have a *real* cron job on that site, however it runs only once per day at 3am, but it has nothing to do with wp-cron.php.

8,502 Points
2014-05-29 1:27 pm
If you've followed the steps here correctly to disable it, the only person who would be able to give you accurate information on it would be your host.
9,968 Points
2014-05-29 4:44 pm
Hello Dorian,

If you've disabled the WordPress wp-cron.php inside the wp-config.php file, but it's still running, this could be caused by one of your plugins. Especially if it is a matter of your wp-cron.php script hanging and causing a lot of usage.

If you are on a cPanel host you should be able to access your raw access logs and take a look for the wp-cron.php requests in you logs.

This might help you narrow down what is still triggering your wp-cron.php executions even though they are disabled upon running every visit.

- Jacob

n/a Points
2014-06-04 4:04 am

I used this method, and added wordpress to the root after username, but i get an email saying NO input file specified. and i get it after every hour. 

8,502 Points
2014-06-04 8:35 am
This means that your reference to the file is broken. Could you provide me with the exact line of code that you have in there for your cron job?
n/a Points
2014-06-04 9:15 am

I copy pasted ur code above, changed user and added /wordpress after public html. Later came back to add email.  However is there a possibilty of cron file having a different name

8,502 Points
2014-06-04 9:44 am
The wp-cron.php file is always in the same place within the WordPress installation. Be sure that the path you are referencing in your cron job is the exact path of your WordPress installation.
n/a Points
2014-06-04 9:58 am

Yup, as i have copied the code from above, there s space after cd . does it have to be there. 

8,979 Points
2014-06-04 10:10 am
Hello Shan,

In the code provided, yes there should be a space after the cd.

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

If you have any further questions, feel free to post them below.
Thank you,

n/a Points
2014-06-14 1:39 pm

Unfortunately the original premise of the post is incorrect, which rather invalidates the main thrust of the topic.

If you would actually check in WordPress rather than simply regurgitate misinformation that you read elsewhere you would know that WordPress does not call wp-cron.php every time the site is visited. WordPress only makes a loopback access to wp-cron.php when there is a scheduled task due to run. I just thought I'd emphasise that so you'd be clear where the error in your original premise was.

In fact if you disable WordPress cron and instead rely upon server cron you can end up increasing the resource usage for a site. Just thought I'd emphasise that since the major claim of the post is the opposite. If you don't understand why I suggest you run through some use case scenarios (and remember that a direct access to wp-cron.php is basically like any other site access and WordPress runs through it's whole initialisation.

The simple example of having a server cron run 4 times a day may not increase resource usage but it certainly isn't going to decrease it. But is 4 timesa day really valid for the type of high-traffic site that the example is pinned on? I would suggest considering something more realistic.

There is a place for a well targetted server cron to fire once at a specific time to trigger a periodic task that you know will be due at that time - but use this in conjunction with WordPress cron.

The only other time you might want to use a more frequent server cron is if the hosting doesn't support http loopbacks and you are required to enable the WordPress alternate cron to haev WordPress cron work (if this is required then this is a bad host and you shouldmove anyway). This has the unfortunate side effect of sometimes making additional nasty query strings be visibly appended to urls that a site visitor might see and only in that case and only if you didn't like that effect would you consider a more frequent server cron, but you'd have to take the hit of increased resource usage compared with using WordPress cron.


n/a Points
2014-07-06 5:07 am

getting the following errors running this cron job:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent in /home/userna5/public_html/wp-content/plugins/botdetect-wp-captcha/wp-botdetect-captcha.php on line 205

Apparently it's connected to the botdetect captcha plugin. But I know nothing about this stuff. Does this mean the cron job is not running? Should I go back to using wp-cron.php? Or should I just ignore these errors?

9,968 Points
2014-07-06 6:16 am
Hello eric,

Do you get the same error when just trying to access the wp-cron.php script directly?


I installed that same WordPress plugin and was unable to get it to run into problems when running from a cron job. Are you using the same method as mentioned in this guide as:

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

If you disable the plugin does your cron job run without errors?

- Jacob
n/a Points
2014-07-07 5:39 am

Hi Jacob, 

I don't know what you mean when you say, "Do you get the same error when just trying to access the wp-cron.php script directly"

I did everything exactly as the article states.  

When I disable the plugin I don't get an email that anything has happened.  No email so that must mean the cron job is running but wp-cron.php has nothing to do.  As soon as I re-enable the plugin the error messages begin again.

I'm guessing this means the cron job is not running when that plugin is enabled?



18,686 Points
2014-07-07 7:19 am
Hello Eric,

Jacob means do you get an error message when visiting "http://example.com/wp-cron.php" itself?

Kindest Regards,
Scott M
n/a Points
2014-07-07 5:49 am

when I try the wget method, I just get an error that I don't have permission . . . 

/usr/local/cpanel/bin/jailshell: /usr/bin/wget: Permission denied

18,686 Points
2014-07-07 7:23 am
Hello Eric,
That is correct, wget is disabled on our servers. You can, however use the cURL method. You can see the format for that here in our Cron job article.

Kindest Regards,
Scott M
n/a Points
2014-07-07 1:51 pm

I get no errors at all when I visit truthsaves.org/wp-cron.php.  I get nothing.  No page load -- just a blank page.  

BUT . . . I have success using the curl method!  THANK YOU!  I am testing the curl method right now and was just able to get a scheduled post to work!  And no error messages.  Thank you very much! 

n/a Points
2014-07-26 10:16 am

What does this mean? Emailed cron to me....

attempt to lock file /home/virtfs/_lock/889 timed out after 25 attempts; lock still held by pid 2170 Could not create lock file: /home/virtfs/_lock/889

9,968 Points
2014-07-26 11:03 am
Hello Andy,

Are you getting this error every single time the cron runs, or was this just a one-time thing? That error is in regards to the virtfs or Virtual Filesystem and seems to also be discussed here on the cPanel forums.

It basically sounds like a stale lock file, but I don't see it on the server anymore. If you continue to see this issue pop up, please submit a ticket so that our system administration team can review why this might keep happening.

One way you might be able to prevent this from happening is by staggering your cron job runs as well. It looks like you have a bunch setup to all run every 6 hours at the top minute 0 of the hour. Maybe go up a minute for each to ensure that one can completely finish before another starts.

- Jacob
n/a Points
2014-07-26 11:15 am

Hi Jacob,

Thanks for your reply, yes i have a bunch of wordpress addon domains for which i am following your guidelines to reduce cpu load on the shared server. So I just followed the instructions in the tutorial to manually add the cron jobs for each wordpress site.

I will try your suggestion and see if it makes a difference.

If not I will create a ticket to see why this is happening.

Cheers, Andy.


9,968 Points
2014-07-26 6:35 pm
Hey Andy,

Sorry for the delayed response, we have to approve comments on articles before you can see them to make sure people don't include any sensitive information in their questions. So that's why you didn't see your comment posted right away.

If staggering the cron jobs so they don't all run during the same minute works, please comment back here and let me know. I can go ahead and update this article itself for other users that have multiple WordPress installs to make sure they don't run into the same problem if that's the solution.

- Jacob
n/a Points
2014-07-28 7:28 am

Hi Jacob,

Reporting back ! I staggered those cron jobs like you said by 1 minute. I don't get any emails with that error anymore, I just get two emails periodically as follows:

from: Cron Daemon <root@ecres155.servconfig.com>
to: user@gmail.com
date: Mon, Jul 28, 2014 at 2:26 PM
subject: Cron <userna5@ecres155> php -q /home/userna5/public_html/admin/cron.php
No input file specified.


And this one:

from: Cron Daemon <root@ecres155.servconfig.com>
to: user@gmail.com
date: Mon, Jul 28, 2014 at 5:08 PM
subject: Cron <userna5@ecres155> cd /home/userna5/public_html/wire-writer.com; php -q wp-cron.php
Warning session_start(): Cannot send session cookie - headers already sent in /home/userna5/public_html/wire-writer.com/wp-content/plugins/wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php on line 13
Warning session_start(): Cannot send session cache limiter - headers already sent in /home/userna5/public_html/wire-writer.com/wp-content/plugins/wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php on line 13


Not sure about the first one, but the second one looks like an error!



9,968 Points
2014-07-28 1:51 pm
Hello Andy,

Thanks for getting back to us, glad to hear that staggering the cron job runs seems to have gotten rid of your first issue.

For the first error that you've provided, it looks like it's trying to run:

php -q /home/userna5/public_html/admin/cron.php

However it doesn't look like you have a /public_html/admin/cron.php file, so that's why it's telling you No input file specified.

I see that you do have a /adminold directory, so possibly you forgot that you renamed this directory after setting up the cron job?

For the second error, it looks like your wire-writer.com cron run is failing due to the WordPress Simple Paypal Shopping Cart plugin that you're running.

It says it has a problem with Line 13 of this file:


Taking a look there I see this:

if (!isset($_SESSION)) {

So it does seem related to something the plugin is trying to do with sessions. Doing a Google search of this issue I stumbled across this WordPress Simple PayPal Checkout Plugin Broken post on WordPress.org.

However I attempted to run that site's wp-cron.php file directly and was not encountering this issue. So I'm not sure if it is tied somehow to it being run from a cron job which would be odd.

I see that the site's cron job has run 3 times already today, are you encountering this error being emailed to you every time, or is it sporadic?

- Jacob
n/a Points
2014-07-30 5:30 am

Hi Jacob,

I renamed the adminold folder back to admin, I don't remember renaming this folder, I will see what happens now.I am getting the other error every 6 hours by email.


n/a Points
2014-07-26 11:35 am

My website is loading slow on mobile devices which is causing a higher bounce rate. When I deactivated the plug in that is causing this I get an error message:

Warning Illegal offset in wp_includes cron.php file on line 180 .....

This is what is on line 180 – “if ( isset( $cron[ $hook ][ $key ] ) ) {“

Any suggestions??

9,968 Points
2014-07-26 6:47 pm
Hello Nathan,

What was the plugin that you deactivated that starting causing this error, and if you re-enable it, do the errors go away?

Most errors I see regarding Illegal offset in WordPress are from years ago. Are you running the latest version 3.9.1 of WordPress currently? You might want to try upgrading if not to see if that helps.

Otherwise it sounds like possibly your plugin that you had activated might have modified the cron.php script in a way that WordPress is not expecting. If that is the case, you can make a copy of your current /wp-includes/cron.php file and then download a copy of cron.php directly from WordPress to ensure you have a unmodified original version of it.

Please let us know if you're still having any issues.

- Jacob
n/a Points
2014-07-28 7:43 am

I found that wp-cron.php continued to fire unless I placed the directive - define('DISABLE_WP_CRON', 'true'); - before this line:

/* That's all, stop editing! Happy blogging. */
While your article does explain a good place to put the directive, I figured I could just add it to the very end of the file. I learned the hard way that the order lines in of wp-config.php is actually important.
9,968 Points
2014-07-28 1:57 pm
Hello Robert,

Yes the placement of the code in the wp-config.php file is important, that's why in this guide it states to look around line 37 for the Database Collate section to place it directly under.

I'll try to update the guide to make it a bit more clear that this is required. Thanks for the comment and letting me know!

- Jacob
n/a Points
2014-09-01 3:28 am

Nice Article

n/a Points
2014-09-24 6:10 am

Ηι, i put the code exactly where the article says, but then  in the main page i view only this...

Parse error: syntax error, unexpected T_STRING in /home/kafeneio/public_html/wp-config.php on line 1



18,686 Points
2014-09-24 11:32 am
Hello Panos,

Be sure to double check and ensure you followed the instructions correctly. If you feel so, then comment out the line you added. Does it still give an error?

Kindest Regards,
Scott M
n/a Points
2014-09-24 11:42 am

is ok now.  now watch the stats from recource usage ! thx

n/a Points
2014-09-25 9:02 am

I followed this advice after a support session. You bet it helped speed up the site, but what good is a fast site if it no longer does what it's supposed to?


My calendar widget is no longer updating. It still thinks it's yesterday. It's also the backbone of my hyperlocal site. Back to support I go...

8,979 Points
2014-09-25 11:26 am
Hello Seth,

Thank you for contacting us. While disabling wp-cron can help speed up your site, it is just a suggestion.

If it is causing problems with your site, it may not be the best option.

Our guide on Optimizing WordPress provides several other suggestions for speeding up your site.

If you have any further questions, feel free to post them below.

Thank you,

Post a Comment

Email Address:
Phone Number:

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

52 Questions & Comments

Post a comment

Back to first comment | top

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!