Menu

Cron jobs

Updated on March 8th, 2023

A cron job is a server-side task that schedules a job to run at a specific time or repeating interval. Cron jobs exist to help automate repetitive tasks or to schedule a task to run in the future – it’s like having an extra set of hands (so your actual hands are free to do something fun, like eat tacos!)

For example, you can schedule a repetitive task to back your site up nightly at 1:00 AM, or you can have a task that only runs once to publish a blog post at 4:15 PM next Tuesday.


Cron jobs at Flywheel

At Flywheel, we don’t allow users to create or manage cron jobs at the server-level, since this would require a higher level of access to the server that we limit for security reasons. Good news though, WordPress has its own built-in robust task scheduling system called WP Cron, and you can tap into this awesome functionality to manage existing jobs or create your own!


Cron jobs with WordPress

WordPress is already using WP Cron behind the scenes for many things, like publishing scheduled posts, checking for updates, and general maintenance. Plugins will also create their own WP Cron jobs automating some of their tasks. For example, the WooCommerce plugin creates jobs for things like reoccurring subscription payments.

Note

The main difference between a server cron job and a WordPress cron job is that WP Cron does not run autonomously at the server-level. WP Cron is triggered when a page is loaded by a visitor of your site. On every page load, it checks a list to see if any scheduled tasks should be running right now and starts those jobs. This is potentially a limitation, but we’ll explain the slick workarounds available below!

Limitations of WP Cron

Low-traffic sites

If you have a low-traffic site, it might not get enough visitors to run jobs at the time they’ve been scheduled.

For example, if a task is scheduled to run at 10 AM, and nobody visits the site until 11:37 AM, that job will be running later than it was scheduled, since there wasn’t a page load to trigger WP Cron. However, you can easily get around this by creating a free account with an external cron service!

The solution, External Cron!

You can use an external cron service to ping the WordPress cron system at a regular interval, like once every 15 minutes, running the jobs that are currently due.

There are a couple of free services you can use to do this.

  • cron-job.org – (Free up to 1 request per minute)
  • EasyCron – (Free up to 2–3 requests per hour)

You need to set the external service to ping your site’s wp-cron.php file.
If your site was "myflysite.com", you would set it to ping: https://myflysite.com/wp-cron.php

Note

New sites and staging sites on Flywheel have our Privacy Mode enabled by default. Privacy Mode blocks public traffic from reaching your site, and because WP Cron runs on page load, it will not work if you have Privacy Mode enabled. When you take your site live and disable Privacy Mode, WP Cron will start working as expected.

Managing and creating WP Cron jobs

So, how do I go about creating and editing cron jobs, you might ask? Well, there are a number of plugins that will allow you to interact with WP Cron jobs.

Our favorite is the WP Crontrol plugin. WP Crontrol allows you to see what jobs are already running on your site, adjust how often they run, as well as create your own WP cron jobs.


Need help?

If you have any questions our Happiness Engineers are here to help!

Was this article helpful?

Getting Started

New to Flywheel? Start here, we've got all the information you'll need to get started and launch your first site!

View all

Account Management

Learn all about managing your Flywheel user account, Teams and integrations.

View all

Billing

Everything about billing, invoices and payments can be found here.

View all

Features

Flywheel hosting plans include a ton of great features. Learn about how to get a free SSL certificate, set up a staging site, and more!

View all

Platform Info

All the server and setting info you'll need to help you get the most out of your Flywheel hosting plan!

View all

Site Management

Tips and tricks for managing your sites on Flywheel, including going live, troubleshooting issues and migrating or cloning sites.

View all

Developer Hub

Learn how to connect, deploy, and more with SSH on Flywheel's platform.

View all

Growth Suite

Learn more about Growth Suite, our all-in-one solution for freelancers and agencies to grow more quickly and predictably.

View all

Managed Plugin Updates

Learn more about Managed Plugin Updates, and how you can keep your sites up to date, and extra safe.

View all

 

Flywheel help

Help is just a click away! Log into Flywheel dashboard to instantly chat with an expert, respond to a ticket, or follow along with in-depth documentation. We happily offer support 24 hours a day, 7 days a week, 365 days a year!

Log in

Try Flywheel today

Launch your next WordPress site in minutes.

 Free migrations  24/7/365 support  14 day demo sites