I never thought I’d say it but sometimes success can bite. I ran many WordPress blogs as time goes on you get better and better at writing blogs that will attract more and more traffic. Though, time though in the not so distant future we’ll find that your success on bringing people to your blog will drive you bananas.
With the latest version of WordPress 3.0 and possibly before hand the usage of the automated tasking within WordPress occurs with a file called wp-cron.php. The concept basically is that every time somebody comes to visit your website this particular file is run to ensure that any tasks that need to be completed will get completed on your blog.
These tasks can include posting schedule posts, pinging those posts than just maintenance tasks that WordPress runs to stay fast and efficient. But once you start getting inaccessible for 100 people per day to a blog you do find that this task runs way too often.
And as you can guess it doesn’t take long to get to 100 people per day. Fortunately for us there’s been some very smart people who figure to way around the problem and fortune the problem is very easy to solve. If you’re not techy minded you might find this little carry but trust me, it is actually not that bad if you understand what is actually happening in the background.
Disabling the Default Running of wp-cron.php
First things first, we have tell WordPress not to run wp-cron.php every time somebody comes to the blog. Fortunately for us it’s a matter of adding one simple line into the wp-config.php file that sits at the root of your WordPress installation. That line is: define(’DISABLE_WP_CRON’, true); .
With this line does is it tells WordPress to disable the automated running of that file.
Next we have to tell our hosting agent to run this file for us. I’ve been a little bit of reading around the Internet it seems that running this fall once every two hours seems to be a good number of times to run it. You can decide to run this last per day if you not updating your posts that often. On most my more successful blogs I find that I’m updating posts once every four or five hours so running every two hours is definitely didn’t cover any of my needs that could occur for the posts.
Now I always recommend that you use a hosting agent that uses a program called cpanel. This makes making really hairy changes within your hosting relatively simple. But there’s a lot of things you can do that are wrong when you’re sending a Cron job. By the way, the expression Craun job is the UNIX way of saying performing a task at designated times.
Telling wp-cron.php To Run Manually
All you have to do is follow the pictures that I’ve created below to help you set up a Cron job. Once again this is for cPanel uses only.
After you’ve logged into your cPanel account you will want to look down the page and to define an icon that looks much like the one pictured here called “Cron jobs”. Simply click on this icon to get into the interface.
Now very quickly look at the next diagram. You see that one command has to read ‘X’ beside it. When setting the settings for a Cron job it’s very easy to select the run once every minute instead of the ones on the hour once in a five minutes after the hour or whatever. If you select once every minute and then you will tell the Cron job to run every single minute of every day and every hour. You get the point, this is a very bad thing.
So basically you select your minutes, hours, day, month, weekday and fill in the command to call the actual wp-cron.php file. Once again take a look at the picture below to give you a bit of a roadmap on what you want to see in each of these fields.
Now you look at the command you’ll notice that it is a bit of a hairy looking thing but basically it’s good to point directly to the wp-cron.php file for your particular WordPress installation. Now you must ensure that you select the correct directory structure, including the cPanel username and if you have your WordPress in an add-on domain it will be within a subdirectory.
If you do get confused by this don’t be afraid to get in contact with your hosting agent and asked them to help you create the command properly. Most hosting agents are more than glad to help you fix this problem. Once you’ve done all of this congratulations you’ve now went from an automated Cron job happening in WordPress every few minutes when that only happens once every two hours. This should satisfy the most stickiest hosting agent on the planet.
As you can see the command that you’ll be entering is ‘php -q /home/cpanelusername/public_html/wp-cron.php’. Note that your command could look different depending on the installation.
I hope that this is helped you reduce the amount of computer and memory usage that you are using on your hosting agent at this time.
Filed under: Learn Wordpress
Like this post? Subscribe to my RSS feed and get loads more!