Tech Notes: Heart Internet and WordPress wp-cron job scheduling

This was a little fault that I found in my development environment, which I’ve recently moved onto my Heart Internet hosting as explained the other day.

The issue is specific to Heart Internet’s hosting and results in any scheduled jobs not running!  Scheduled jobs could include automatic updating, database cleaning and posting of scheduled posts, but could also include other features provided by plugins, such as automated database backup.

wp-cron – how WordPress does scheduled jobs

WordPress normally runs on a Linux or Unix server, and, as such, you could use the “cron” feature of Linux/Unix to run scheduled jobs. BUT…most web hosts don’t let you have access to cron – and rightly do: you could do a lot of damage through incorrect use.

WordPress, though, needs to be able to do some useful scheduled tasks, things like cleaning up deleted items, and publishing posts scheduled for future posting.

So, WordPress uses what is often called “pseudo-cron”. There is a script – wp-cron.php – that runs all the scheduled jobs, and WordPress tries to run this script whenever someone visits your website.  It does this by loading the web page http://<your-domain>/wp-cron.php  It will do this at most once per minute.

You can use a plugin like cron-view to see what’s in your list of scheduled jobs. For me, it was some automated digest emails not sending that brought the issue to my attention!

A Heart Failure

Heart Internet don’t allow a PHP script (or any script) running on its server to make an HTTP request back to the domain that the script is running on. It’s possible, though I’ve not investigated it, that they don’t allow a request back to the server, or to any of their servers, potentially blocking HTTP access to other domains that they host too.

So, the short story is that if you’re running an out-of-the-box WordPress install on Heart, none of its scheduled jobs will work!

I discovered this thanks to numerous forum posts, including this 6-day-old one on the WordPress support forums for a backup plugin.

A Solution

There’s another very helpful discussion over on the WordPress Forums that both explains why wp-cron is implemented the way it is, and offers a workaround: add the following to your wp-config.php

define('ALTERNATE_WP_CRON', true);

The fix is described as “a bit iffy sometimes”, and I’ve not tested it, but I would recommend giving it a go if you’re running WordPress on Heart’s servers.

Another Solution

Another way to tackle this is to make use of the fact that Heart let you run cron jobs anyway, so you can just set up a cron job to run once every 15 mins to run wp-cron.php.  This is probably a better solution but it’s a bit of a pain setting it up for every WordPress install you’ve got…if, like me, you have many!

Tags: , , , , ,

6 Responses to “Tech Notes: Heart Internet and WordPress wp-cron job scheduling”

  1. Dan Moat May 29, 2012 at 12:57 pm #

    I’m glad you posted this it has saved me a lot of head scratching. Just as I discover wp-cron I realise it is redundant haha. I will try the alternate method else, while I can only do hourly cron jobs with my Heart (or 20 minutes if I set up three), it will have to do!

  2. Lucy Rabbit May 6, 2013 at 12:34 pm #

    Aha! I am seeking a decent backup solution for my many hosted WP client sites on Heart. Would be best if one cron job could rule them all… The alternate cron setting in wp-config works for me but makes an ugly call you can see in the URL. This is likely to upset my clients who aren’t sure what is happening. More if I figure out a more elegant solution for multiple sites…. Thanks for your post btw!

    • Ross Wintle May 7, 2013 at 1:12 pm #

      Hi Lucy,

      If you have “many hosted WP client sites” I’d recommend using a management tool like InfiniteWP, ManageWP or iControlWP? These handle not just backups but WordPress updates, site migrations/clones, comments, posts, pages, users, and so on. I’ve done a comparison at – it’s a bit old now (I need to add iControlWP) but gives you an idea of what the tools look like and do.

      Drop me a Tweet if you want a hand (I’m better on @magicroundabout than @oikos_uk)



  3. Charlotte Craig June 11, 2014 at 12:07 pm #

    Thanks Ross, this post has been really helpful and solution 1 works perfectly.

  4. Jane July 14, 2014 at 5:07 pm #

    If you can’t set up a cron with your host or don’t know how to, a third party webcron may be a good option for you. I am using for my crons.

  5. Scott October 6, 2015 at 4:06 pm #

    Sorry for reviving an old post..

    I thought I was on to sorting this after finding this post, but putting define(‘ALTERNATE_WP_CRON’, true); in wp-config.php doesn’t seem to have sorted it :(

    I’m on heart internet too.

    What a pain this has turned into be!

Leave a Reply