With WP RSS Aggregator, you can set a feed update cron interval as a general setting or even on a per-feed-source basis. What this means is that you can set a feed source to fetch feeds every 15 minutes, or every hour, etc. Custom intervals can also be set. Are your feeds not importing? Chances are you are having problems with the WordPress cron system.
What is a Cron?
Cron is a system originally built for UNIX that enables users to execute commands, programs and other actions at specified times. As Wikipedia so eloquently puts it, “Cron is a time-based job scheduler.” Basically, what that means is you can schedule an action to take place at a specific time, without having to manually execute code at that time.
And What About WordPress Cron?
WordPress Cron is what many people refer to as a “pseudo-cron system.” The difference is in how UNIX cron and WordPress Cron take action. A typical UNIX cron system runs in this order:
- A time tied to an action occurs.
- Cron runs the action tied to that time.
With WordPress Cron, it works a little differently:
- A visitor comes to any page on your WordPress website.
- WordPress Cron checks each cron event to see whether the scheduled time has passed.
- If the scheduled time for that event has passed, then WordPress Cron executes any actions tied to that event.
As WordPress is installed on so many different setups, to make things run properly, WordPress developers implemented this pseudo cron system that helps run scheduling jobs such as:
- Checking for theme & plugin updates
- Publish scheduled posts
- Sending pingbacks
- and more!
Unlike regular cron jobs, which run at a specific time based on the server settings, the WP-Cron function runs every time someone visits the WordPress powered website. This makes a WordPress site run properly on different kinds of server setups because it eliminates a lot of server-specific requirements. On every page load, WordPress checks if there is a need for WP-Cron to run. If there is a need, then it tries to make a request over HTTP to the wp-cron.php file. The reason to call wp-cron.php is that some jobs might take more time and the user requesting the WordPress page cannot be made to wait. Calling the wp-cron.php helps keep the WP-Cron function running as a separate process in the background without delaying the page load time for the user. Once the WP-Cron function starts, it continues to run until all the required jobs are completed or until it reaches an execution time as set in the server configuration.
The most common reason for feeds not importing is a stuck cron system. We’ve seen it time and again, WP RSS Aggregator would be set up perfectly but all the importing cron jobs are getting stuck, thus no imported items/posts. How can you determine if you are having problems with cron? Easy, download WP Crontrol, a free plugin from the WordPress.org plugin repository. Then head to Tools > Cron Events and you will see a list of cron jobs. This is how a normal cron job list should look like:
If they are all stuck running now (as in the screenshot below) then you are having problems.
The easiest way to get this issue solved is to contact your host, explain the situation and even provide a link to this page so that they can see exactly what the problem is.
Limitations of WordPress Cron
You may be wondering, “What happens if no one visits my website at all? Does WordPress Cron not run?” The biggest limitation of WordPress Cron stems from its inability to run without visitors. This leads to a few potential issues.
WORDPRESS CRON IS IMPRECISE (ZERO VISITS = ZERO CRON RUNS)
If you’ve scheduled a feed source to update every 15 minutes, but you only get one visitor on that day, the cron job that fetches feeds for that source will only be triggered once during that day. So, consider the impact of no visits. If a website gets no traffic at all, then WordPress Cron will never run. Of course, we hope your website will be getting many visits, however, this is a consideration to keep in mind especially for new sites that are still building their traffic base.
Getting Around the Limitations
Before attempting the instructions below, please try the alternative (and simpler) solutions here.
To make sure you’re not affected by the limitations of WordPress Cron, you can define real cron jobs to run. How do we do that? Note: Your hosting provider has to have cron support for this to work, not all of them provide this, especially shared hosts.
1. Disable WP Cron
In your wp-config.php file, add the following line:
This will now stop the internal WP-Cron function from executing and will not call the wp-cron.php file. What you’re disabling is WordPress’ built in functionality for firing its cron jobs on every page load.
2. Setup a Server Cron Job
Next, simply request wp-cron.php directly using cron. For more information on cron, the Wikipedia article is a good starting point. Most web hosts provide an interface for defining cron jobs, but not all applications are running within the context of a cPanel-based web host. Some are simply running on an internal server or something similar where all you have is access to the command line. And considering that the cPanel is nothing more than a GUI to the command line, here’s what you need to know to define a cron job at the operating system level:
$> crontab -e
Next, add the following line into the cron file:
*/15 * * * * wget -q -O – http://yourdomain.com/wp-cron.php?doing_wp_cron
Yet Another (Easier) Alternative
Instead of setting up cron using your server, you can use one of the many online cron services. All you have to do is sign up with them and set a time interval for them to ping your wp-cron.php file. This is a very popular method of kickstarting WordPress cron, in fact, the EasyCron.com website has a special guide for WP RSS Aggregator users, giving a step by step procedure for setting things up. EasyCron also provides a WordPress plugin for easily setting up cron jobs with their service. Some recommended online cron sites are: