By default the WordPress tasks that have been set up to run with wp-cron.php only run when a WordPress page is visited by a user, if the site has low traffic then tasks make take a while to action, if the site is high traffic and has caching then this can also cause reliability issues, instead you can manually set up the cron tasks to run at a. Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!
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 new feed items every 15 minutes, every hour, or how often you'd like. Custom intervals can also be set.
What is a Cron?
Cron was a task scheduler system originally built for UNIX to enable users to execute commands, programs and other actions at specified times.
This means you can schedule an action to take place at a specific time, without having to manually execute code at that time.
WordPress Cron is what many people refer to as a “pseudo-cron system.” The difference is in how UNIX cron and WordPress Cron get into action. A typical UNIX cron system runs in this order:
- A time tied to an action is reached.
- 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 its scheduled time has passed.
- If the scheduled time for that event has passed, 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
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 allows a WordPress site to run properly on different kinds of server setups because a lot of server-specific requirements are eliminated.
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 automatically 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 resulting in no imported items/posts.
How can you determine if you are having problems with cron? Easy, download and install 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 showing now (as in the screenshot below) this means the cron jobs are stuck.
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 understand the exact problem.
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 every few hours, the cron job that fetches feeds for that source will be triggered only once in several hours.
So, consider the impact of no visits. If a website gets no traffic at all, 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.
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. Read on to know how.
Wp Cron Php
Set Up a Server Cron Job
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 will be running within the context of a cPanel-based web host. Some will be simply running on an internal server where all you have is access to the command line. 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:
Next, add the following line to the cron file:
Wp Cron Plugin
Wp Cron Exploit
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.
Wp Cron Daily
Some recommended online cron sites are: