How to configure a Cron Job on WordPress
What is a Cron Job?
A Cron job is a task that is scheduled to run at a specific time automatically. For example, a Cron job can back up a file every six hours automatically.
Booknetic uses the standard WordPress Cron Jobs for sending reminder messages. The default WordPress Cron Jobs might cause delays in sending reminder messages. Because, by default, WordPress does not use a real Cron job. Instead, whenever a page is loaded on a WordPress site by any user, WordPress runs the Cron Job Tasks. If nobody visits your WordPress site, your tasks will not run. As a result, your messages will delay.
To resolve these issues, you should disable the default virtual WordPress Cron Job, and configure a real Cron job. To do this, follow the instruction below:
1. Add the following line to the wp-config.php file:
2. Copy the command below and change the yoursite.com with your own website name:
wget -O /dev/null https://yoursite.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
3. Log in to the "CPanel"and find the Cron Jobs;
4. And paste it to the proper textbox on Cron Jobs. Make sure everything is the same with the picture. If you want the messages to be sent at the exact time you defined, you need to set the Cron Job every 15 minutes.
Please consider that choosing a proper Cron Job interval can change according to your sync choice.
Don't you have a Cpanel, or for some reason, you can't set up a Cron Job by following the above steps?
It is also possible to use third-party services for Cron Job configuration. There are a lot of platforms that provide the free Cron Job service for websites. But we would like to recommend to you the most popular and the free one - cron-job.org
- You can simply register through the platform in order to use the service
- After signing in to the system, please click on the "CREATE CRONJOB" button at the top right of the website
- You need to write the WP-Cron link in the URL section without other commands. The WP-Cron link for your site will be as follows. https://yoursite.com/wp-cron.php?doing_wp_cron
- After making all adjustments, click on the "TEST RUN" to ensure that the service is working. Once the test run is successful, click on the "CREATE" button and create your Cron task.