How to Run WP Cron Manually
February 14, 2022

WordPress has a really strange way to run cron jobs. As soon as a visitor visits your website, WordPress checks to see if any cron jobs are due and runs them. In this tutorial we will see how to run WP cron manually.

The way WordPress runs cron is not real, what will happen if no one visits your site the whole day (although this should not happen, as someone should visit your site at least once a day, otherwise whats the purpose of having a site)?

We will see how to run real cron jobs and how to disable the WordPress cron job intimidation. You can learn more about how WordPress handles cron jobs here.

Step 1: Disable normal WordPress Cron Jobs

First, you should disable WordPress’ normal cron behavior, as it will slow your site down. In the case of a slow server, if you have 500 cron jobs configured, WordPress will attempt to run these jobs whenever a visitor opens your site, which will take a long time to load the page.

You need to open wp-config.php which is normally located on the document root of your WordPress site and add following snippet

define('DISABLE_WP_CRON', true);

How to disable WordPress Cron on CloudPages

As I’ve mentioned above normally wp-config.php file is located in document root of your website. Let see how we can find and edit it in CloudPages so that we can run WP cron manually.

1. Login to CloudPages dashboard and you will see something like this:

Select the project where your server is located.

2. Once you click the project, you will see something like:

Click on “List Servers

3. Clicking on “List Servers” will take you to the list of servers, which will look like:

From the list of servers select the one which have your WordPress site (for which you want to disable WP Cron)

4. You will now land on your server dashboard, from where you will go to your WordPress site

Click on WordPress Manager from left side menu

5. From the list of WordPress sites, click on the site you want to disable WP Cron for

6. Once you are in WordPress Manager of your site, click File Manager

7. Finally you are in File Manager of your WordPress site, click on public_html and you will be able to see wp-config.php file, now open this file by clicking on the file name and enter the code mentioned above

Once you added the piece of code mentioned above, just click “Save Changes

This will disable normal WordPress cron jobs if your site is deployed via CloudPages. Does not matter which control panel are you on, the process is similar, use your web host file manager, find wp-config.php and disable WP cron.

Step 2: Run WP Cron Manually

Now lets run a real cron job which will actually run without you or your visitors having to do anything. Go to your Control panel/ web host cron job manager and schedule following cron:

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

Replace domain.com with your actual domain, and the time interval for this cron should be every 5 minutes.

CloudPages have a dedicated cron job manager which you can use to easily set up this cron job.

What is a cron job?

Cron job is a service built into all Linux servers that runs tasks at scheduled intervals. Cron job (also known as server cron, , system cron, or “real cron job”, linux cron).

On the server, these processes are listed in the crontab file. (Usually located in /var/spool/cron/crontabs/ for Ubuntu/Debian and /var/spool/cron for CentOS/RHEL and.)

For example on a CloudPages server, cron jobs looks like

21 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
*/5 * * * * python3 /usr/local/LitePages/LPCron.py WriteServerStats
0 0 * * * python3 /usr/local/LitePages/LPCron.py Ping
5 8 * * Sun python3 /usr/local/LitePages/LPCron.py UpdateCFIPs

If you wan’t to see cron jobs for a certain user on your Linux server just run crontab -e and it will open cron job file of currently logged in user.

What is WP-Cron ?

The WordPress cron service is simulated by the PHP function WP-Cron built into WordPress.

There’s no actual checking of the server’s crontab file every second and running of scheduled tasks. There is an internal “cron handler” file (not a file but stored in a database) which is only checked each time the website is loaded. It’s not a real cron job, as some developers like to say.

Habbi is the Lead Dev Engineer at CloudPages. He also loves to write about WordPress, SEO and Digital Marketing.

Recent Posts

Get Newsletter Updates

How To Properly Backup Your WordPress Website?

How To Properly Backup Your WordPress Website?

Are you looking for versatile ways to backup a WordPress website? It’s essential to create a full backup for your WordPress site as it helps you recover or restore your website when something goes wrong. You never know when something bad will happen and you will lose...

read more
How to Fix the 504 Gateway Timeout Error?

How to Fix the 504 Gateway Timeout Error?

If you’ve ever visited a website that serves you on an error page, you would have experienced how frustrating it is classified as the most frustrating thing you can do as a brand doesn’t meet your target audience's needs and expectations. If you’re a website visitor,...

read more
Why Good Page Experience is Needed For Every Website

Why Good Page Experience is Needed For Every Website

Technology isn’t perfect! However, regular monitoring and maintenance help it run as smoothly as possible. This can be true when it comes to managing your server. There are many who are still in search of the optimal server solution for their website's better page...

read more



Submit a Comment

Your email address will not be published.


Join Our Newsletter

Pin It on Pinterest

Share This