How to set up a real cron job in WordPress?

WordPress real cron job refers to a method of scheduling and executing tasks, such as updating plugins, sending email notifications, or performing other automated actions, within a WordPress website.


Using Cronjob

1

Navigate to the wp-config.php file, which is located in the root of the folder where WordPress is installed.

2

Once you open the wp-config.php file, insert a new line after define('WP_DEBUG', false);.

3

Add the following code on the new line and save the changes:

define('DISABLE_WP_CRON', true);


Alternative

📝 Note: If you are not sure how to navigate to this file via your Cpanel or FTP, you can install this plugin, which will allow you to edit the files on your server directly from within WordPress. 

1

Navigate to the File Manager panel.

2

Right-click on the wp-config.php file and click on Edit Code.

3

Search for the definer('WP_DEBUG', false); line and add the following line:

define('DISABLE_WP_CRON', true);

4

Click on Save & Close.


Once you have turned off the default WP Cron, the plugin that uses it (in our example, Feedzy RSS Feeds) will generate a warning notice:

5

Go to https://console.cron-job.org/signup, create an account, and log into the website.

6

Open the Cronjobs panel and click on Create Cronjob.

7

Fill out the  details of the Cronjob

For  Title, enter anything you wish; for URL, enter your website domain suffixed with  /wp-cron.php?doing_wp_cron.

Example https://yourwebsitedomain.com/wp-cron.php?doing_wp_cron

  • Change yourwebsitedomain.com to your actual website domain
  • If your website does not have SSL, then change https to http
8

Finally, set the Execution schedule to suit your needs.

9

You can use the Test Run button at the bottom of the page to see if it works:


Via Cpanel

The other method to fix the issue is creating a true cron for your website. This requires you to have access to your cPanel account to make the following changes. 

📝 Note: HostGator has gone ahead and created a pretty detailed document on how to create a true cron for WordPress, so we will use it. Please go here to view the document:  How to create a true cron for WordPress. The screenshots from the article refer to HostGator, so the interface might be different according to the hosting provider.

If you are not comfortable with performing any of these methods, then we highly recommend you contact your web host for assistance. They will be able to perform either method for you in no time.

If you are having trouble implementing this method, then please forward this document to your Web host support personnel. They will be able to implement the true cron for you. A recommended interval for the cron job would be once every 10 minutes.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us