Replace WordPress Cron with a Real Cron Job

FluentCRM depends on CRON jobs to automate the background processes like sending emails, processing automation funnel actions. We use background jobs to make your WordPress frontend fast so it does not affect your site speed.

WordPress default cron is not reliable and it depends on your site traffic. It’s always better to use server side CRON handler.

Disable default wp-cron.php behavior #

We can easily tell WordPress to let us handle the execution of wp-cron.php with the wp-config.php file.

Add the following like to your wp-config.php. It will disable built-in cron of your WordPress

define('DISABLE_WP_CRON', 'true');

Now you have just disabled default wp-cron now, based on your hosting you can setup real cron. Here we are showing for several. Please select and configure based on your hosting:

Cpanel: Setup manual CRON job for WordPress #

Please follow this section if your hosting provider offer Cpanel.

Login to your hosting CPANEL and then search for CRON

Click on Cron Jobs and create a new one

Select Once Every Minute from Common Settings

Then in command add the following command

wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Please replace https://yourdomain.com/ with your site URL. after that click “Add New Cron Job” and you that’s done. Now, Your WordPress Cron jobs will be independent of WordPress’s default handler. That’s all for CPANEL configuration.

If you know your php path and wp-cron.php path you can add the following code in the Command instead of wget solution

/usr/local/bin/php /home2/website/public_html/wp-cron.php

VPS: Setup manual CRON job for WordPress #

If you use a VPS and have SSH access then this section is for you.

Login to your server by SSH

Then run the following command:

crontab -e

This system uses specific syntax to schedule Cron Job.

Use the following example to define a Cron Job which executes every minute.  

Add the following line:

 * * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

* Please replace yourdomain.com with your own domain.

You can also use alternative method by directly executing the wp-cron.php file

* * * * * /usr/bin/php /path/to/wp/wp-cron.php > /dev/null 2>&1

* Please replace /path/to/wp/wp-cron.php with right path and make sure your php path is also correct.

That’s it. No need to read the next section if you use a VPS.

CloudWays: Setup manual CRON job for WordPress #

Go to Application Management > Cron Job Management > Add New Cron Job

In the next screen add the location path of the wp-cron.php file and how often you want to run it, my example runs it every 30 mins.

(By setting the cron job up with the Basic tab in Cloudways, the task is automatically run by PHP, whereas in cPanel you need to explicitly add the PHP path. If you swap to the Advanced tab in Cloudways you’ll see the PHP path in full)

External Services: Setup manual CRON job for WordPress (cron-job.org) #

You can also use external services to run your cron job. In this example we are using cron-job.org

Create an account

Create an Account with cron-job.org. 

Setup the cron job

After verify your email, login and go to Members -> Cronjobs -> Create Cron Job and setup like the screenshot

* Please replace youtsite.com with your correct domainname

That’s it

If your server does not match any of it then you can search in google by your hosting company name and cron or contact with your hosting providers.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *