How to configure cron-jobs in the right way in Your WordPress Website?

Parth Shah
Techcompose
Published in
2 min readOct 5, 2018

A Cron job is a standard Linux command or script that used to schedule a task to be executed automatically at a specified time/date. For example, you have scheduled a daily report of registered users, Cron jobs will automatically execute it daily basis at a specific time.

How to use Cron in WordPress?

In WordPress, wp-cron.php file is already located in the root folder. Before using cron we have to disable wp_cron, and set up real cron jobs.

Why disable wp_cron over real cron?

Here are some of the scenarios that real cron is better over wp_cron:

1. Reliable, accurate cron jobs that fire on time as expected.

2. Make the website faster

3. Eliminate high CPU usage

How to disable wp_cron?

To disable WordPress cron jobs, go to your project root path and open wp-config.php file and add below code.

define(‘DISABLE_WP_CRON’, true);

How to use real cron jobs?

Here are the steps to set-up cron jobs on your website.

Step 1: Login to your cpanel account

Step 2: Goto advanced > Cron Jobs

Step 3: Add new cron job

Add command

wget -q -O — http://yourwebsite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Note: Replace yourwebsite.com to your domain.

How to use con jobs in multisite?

It’s all about single blog/website cron jobs in above sections. WordPress cron has to be run individually for each site/blog on the WordPress multi-site network. Alternatively you can use cron by adding filename wp-cron-multi-site.php in root folder. Put below code into file:

Use below command in cpanel:

wget -q -O — http://www.yourwebsite.com/wp-cron-multi-site.php?doing_wp_cron >/dev/null 2>&1

If in WordPress Cron jobs is still not working then you have below possible solutions:

1. Contact hosting provider and ask them to enable WGET or ask them for a alternative

2. Use third party online cron job service such as EasyCron for your cron jobs

3. Get proper Hosting

There are numerous possibilities in WordPress. Get your website done by leading WordPress Development Company, which provides you safety enable, elegant design and feature rich website which grows your Business. Contact us to discuss your Website project or Hire Dedicated WordPress Developer. You can also reach us at inquiry@techcompose.com

--

--