Using a Real Cron vs WP-Cron

Last updated

Why would I need this?

By default WordPress handles WP-Cron events by processing the queue of scheduled events, when any visitor comes to your website. By configuring our own cron we don’t have to wait for the site to be visited in order to make sure out events happen as a specific schedule. This is very important when you are expecting scheduled posts, promos or business critical functionality to happen when you expect it to.

Setting the cron interval time

When using any plugin that needs more accurate scheduling of events. This includes WooCommerce, Woo Subscriptions, Automate Woo, etc, we recommend implementing either a system level cron job, or utilizing a service like Linchpin’s own https://cron.linchpin.com This allows you to have a more accurate schedule of when events within WordPress or your WooCommerce store happen.

Generally MOST sites you can set an interval time to five (5) minutes: In the below example we are showing the traditional crontab formatted schedule of “every five minutes”.

*/5 * * * *

Next in this example, we utilize a simple wget request to to then call a specific URL. The way WordPress manages cron requests being processed happens via a specific file wp-cron.php

Use the following command (replacing YOUR_SITE_URL with your domain):

wget -q -O - http://YOUR_SITE_URL/wp-cron.php >/dev/null 2>&1

After setting up the server cron job you should disable the normal WP-Cron request by adding the following line to your wp-config.php file:

define('DISABLE_WP_CRON', true);

The snippet above will need SFTP or SSH access in order to implement in most cases or may need developer or Agent intervention, and it’s also something you want to make sure you don’t skip. This constant within your config tells WordPress that it doesn’t need to worry about the Cron, and it is managed elsewhere

Have a question about this page?

Linchpin assistant

Was this helpful?