On average, corporate personnel spend around 40% [1] of their working time on tedious and repetitive tasks. This not only contributes to worker fatigue but also prevents people from using their time for more productive tasks.

To tie this to the world of WordPress and website administration, a tool that can help mitigate an issue of that nature by automating such repetitive tasks is known as a “cron job.”

Read on to learn “what is a cron job?” and how you can set one up in WordPress.

What is a cron job?

A cron job is a time-based task scheduler in WordPress. It is essentially a Linux command or task that is initiated on a designated date, time, or time interval. These commands usually involve updating monitoring, permanent comment deletion, content scheduling, and other processes that run in the background.

Why use a cron job?

There are many benefits to using a cron job. For one, it lessens the need for manual operation and allows you to put some WordPress operations on autopilot. This means that you can focus on more critical aspects of site management and don’t have to spend as much on manpower, as it ensures that repetitive tasks are consistently and accurately accomplished on time.

There are several tasks that can be automated by a cron job. This includes publishing posts, checking for plugin or theme updates, sending email notifications, and more. You can even use it to automatically back up your website data and content at regular intervals.

Setting up a cron job in WordPress

WordPress has a dedicated cron system called WP-cron. This system allows users to schedule tasks on an hourly, daily, or weekly basis. However, time-based commands only get executed once your website pages are loaded or when a user visits your platform. You can easily set up a cron job in WordPress using cPanel.

Step-by-step guide

To begin, log in to cPanel. Once you’re in the dashboard, go to the Advanced menu page and select the Cron Jobs icon. Alternatively, you can look for the icon in the search box.

what is a cron job

You’ll be directed to a page showing an email text field. This is where you’ll input the email address that will receive the cron output. After typing your preferred email address, select Update Email.

Then, proceed to the Add New Cron Job section. You’ll find a Command text field in the bottom part of the interface. Input your preferred task there.

set up a cron job

Then, take your attention to the Common Settings field on top. Press the dropdown button and select your desired command execution frequency. You can likewise manually adjust the time intervals using the Minute, Hour, Day, Month, and Weekday fields. Each time element can be tweaked to your liking.

After entering your preferred command and schedule, click on the Add New Cron Job button, and that’s it. Simply repeat the process if you want to create, configure, and save more cron jobs. The command field is where you can put any Linux command or, alternatively, you can add a path to a PHP file, which holds the instructions that you’d like to have run.

To test if the cron job is working, use WP-CLI and enter commands like wp cron event list and wp cron event run {job name}. There is also a plethora of plugins available in the WordPress inventory that can check, edit, and manage scheduled cron events. These include WP Crontrol, Cron Logger, and Advanced Cron Manager.

Conclusion

To sum up “what is a cron job?,” it’s essentially a time-based and automated command that frees WordPress users from the hassle of manual task execution and scheduling. Automate tasks in your WordPress platform today for improved productivity and efficiency.

By the way, wondering how to disable cron? Read this.

0 Comments
Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!