Cron Jobs

WP-Cron is how WordPress handles scheduling time-based tasks in WordPress. Several WordPress core features, such as checking for updates and publishing scheduled posts, utilize WP-Cron. The “Cron” part of the name comes from the cron time-based task scheduling system that is available on UNIX systems.

The major difference between Cron and WP-Cron is how WP-Cron is triggered. Cron is a system process that runs every minute and looks for tasks to execute. WP-Cron, because it is a web-based system, can only run when someone visits the site.

Problems With Low Traffic Sites

Low traffic WordPress sites may experience skipped tasks when this feature is triggered by visitors. If people aren’t visiting your site, WP-Cron can’t execute. This doesn’t mean your page will be slow from previous jobs when someone eventually does visit your site. Regardless of how many tasks WP-Cron has to execute, they are run in the background so your site’s performance is not adversely affected.

Problems With High Traffic Sites

If your WordPress-powered site is high traffic, you may run into problems with WP-Cron. The main issues that come up are race conditions and long-running processes.

Race condition: When more than one user visits your site and triggers WP-Cron to execute the same task. WP-Cron works hard to eliminate race conditions, but they can still happen, especially on high-traffic sites.
Long-running process: Any task that takes longer than the standard 60 seconds to run. Developers can adjust how long a PHP task is allowed to run with the set_time_limit() function. If this is set to be longer than the window between tasks, then you can end up with more than one copy of wp-cron.php executing

­How to Manage the Cron-job

There are two types of cron jobs: one that runs on the website level and one that runs on the server level. The best way to solve the problems discussed above for high traffic and low traffic sites is to configure the cron job to work on the server level. In order to do that you need to contact your hosting provider and ask them if they can configure the cron job to work on the server level for your website.

Cron in Paid Member Subscriptions

Paid Member Subscriptions also make use of Cron in order to perform certain actions. The plugin works with the built-in WP-Cron and with the WordPress cron configured at the server level. The most relevant events we use are listed below:
Process recurring payments
Recurring payments that are done through the Stripe or PayPal Express with Reference Transactions enabled gateways are processed by the plugin using a daily cron job: pms_cron_process_member_subscriptions_payments
Setting the status of subscriptions to Expired
The status of Subscriptions is set to Expired using a daily cron job: pms_check_subscription_status
Setting the status of payments to Failed
Pending payments are the result of some payment gateways which don’t offer instant payment verification. Pending payments which will never complete are set to Failed using a daily cron job: pms_cron_process_pending_payments
Sending Email Reminders
Configured Email Reminders are sent through an hourly and daily cron job: pms_send_email_reminders_hourly
and pms_send_email_reminders_daily

Paid Member Subscriptions Pro

Accept (recurring) payments, create subscription plans and restrict content on your website. Easily setup a WordPress membership site using Paid Member Subscriptions.

Unlock PRO Features

Or download FREE version