Need to “kick” the wp_cron? – automated jobs not finishing?

There are times, especially when a site is new, where you may want some automated processes to run. These will mostly be controlled by the wp_cron, which is a sort of WordPress Clock.

The cron is made efficient by only being run when a page request is made. Now, when sites are new, there can be hours, even days between visitors. Without visitors, your cron stays silent and timed jobs are never fired, or very late. This could miss auto posts, tweets or backups.

A simple answer to this is to setup a local page loop. You will see some javascript code below which needs to be put on a new page. When you then access the page, it will be refreshed every 5 seconds. Each time a refresh is made, the cron will have a chance to run.

You need to change the URL contents to the content of the page you have created. You can change the delay time. I do not recommend making it any faster, but you could make is longer. You have to leave this browser running for the loop to continue. When you close the browser, it stops. If anybody else goes to that page, then they will start the loop, so check you do not automatically add it to any menu.

This is a good solution for short-term time issues, but if you need longer term support, then I suggest you look at subscribing to one of these external cron services, or add the PHP control. All subject to your hosting provider, so it is worth asking them their preferred solution.

The code below must be added with the content editor in “text” mode. Remember to change the URL to that of the final page. 5000 is 5 seconds. If you need something every 5 minutes then use 300000.

<script type="text/javascript">   
function Redirect() 
document.write("You will be redirected to loop this page every 5 seconds"); 
setTimeout('Redirect()', 5000);