Set Schedule Notifications With Crons
WordPress Crons are the scheduler that helps to send Notifications and Reminders from a website as per the schedule. Crons on WordPress execute when your website is accessed from the front end and at the same time, notifications and reminders are sent according to the schedule. So, sometimes, it may happen that your website might not get accessed due to a lack of internet traffic, which may lead to sending reminders late. For example, a reminder is to be sent before the 12 hours of the appointment, and now suppose, the website is not accessed in the past 24 hours, so the WordPress cron will not be executed and reminders will not be sent, and if the same website will be accessed before 6 hours of the booking, WordPress cron will be executed and the reminders will be sent leading to the late reminder.
So, to overcome this concern, you can set the Crons at the cPanel of your site. Please note that setting the Crons manually at the cPanel is totally optional, so if you think that there is enough internet traffic at your site each time, then you can skip this option.
You can set your cron timing by simply adding the Cronjob link from your Hosting Control Panel and Crons will be refreshed automatically as per the time set so that there is no hurdle in sending the notification.
It is highly recommended to set the Crons to be executed every 5 minutes so that the reminders from your server are sent from time to time.
You can set the Command before adding the URL to execute the crons based on time,
Below are the 5 options are for date-time setup:
- 1: Minute (0-59)
- 2: Hours (0-23)
- 3: Day (0-31)
- 4: Month (0-12 [12 == December])
- 5: Day of the week(0-7 [7 or 0 == sunday])
Depending on different servers, there are different configurations the cron, for which you can contact your hosting provider, or you can have look for one of the solutions for it from Here.
So, for example, if you want to execute the Crons every 5 minutes, then you can set the URL as below:
*/5 * * * * wget -q -O "https://www.your-website-url.com/?bpa_action=bpa_send_scheduled_notifications"
Don’t forget to replace the www.your-website-url.com
with the actual URL of your website.
You can refer to the different hosting provider documents regarding how to create and set the cron jobs:
- Kinsa: https://kinsta.com/docs/write-cron-job/
- GoDaddy: https://www.godaddy.com/help/create-cron-jobs-16086
- Bluehost: https://my.bluehost.com/hosting/help/411
- HostGator: https://www.hostgator.com/help/article/how-do-i-create-and-delete-a-cron-job
- SiteGround: https://www.siteground.com/tutorials/cpanel/cron-jobs/
- Linux: https://www.taniarascia.com/setting-up-a-basic-cron-job-in-linux/