When you own a website, speed and reliability are the 2 parameters you must provide for an optimal user experience; failing to do so will result in losing business.
For a faster and reliable website
Wappointment is designed in a way that long-lasting processes or processes relying on external services are placed in a queue. These processes then can be run later on in a background task, this generates 2 benefits:
- Reliability: If for some reason, the process fail, we can try again later instead of just failing immediately and returning a puzzling error to your user. No data is lost, and the process is clean for your user.
- Speed: Connecting to an external API or sending emails are processes that may take a few seconds to complete, putting them to process later is perfect for your user, the booking process goes fast and your website is fun to work with.
WordPress has a built-in system to handle our scheduled background tasks. Each of the plugins you have installed on your site may run scheduled tasks in the background.
The default system in WordPress is relying on your site’s traffic, the higher the traffic the bigger the chance your background scheduled tasks will run on time. Now the default system is unreliable and may make your website slow as these tasks will run randomly while your visitors are browsing your website.
While setting up a CRON task can be a bit challenging, you will gain a lot in terms of reliability and page load and therefore business.
Disable WP Cron
The first thing you’re going to need to do is disable that default system relying on your site’s traffic to trigger scheduled tasks.
Just edit your wp-config.php at the root of your website, and before the line “/* That’s all, stop editing! Happy blogging. */“
Write the following line:
That’s it! It’s disabled, no scheduled tasks will run anymore, which is ok since your system was not working in a reliable way to start with.
Setup a real CRON job
Depending on your host, setting up a cron job will be done in a way or another.
- SiteGround : Setup a cron on SiteGround
- WP Engine : Setup a cron on WP Engine
- Bluehost: Setup a cron on bluehost
- DreamHost: Setup a cron on DreamHost
If it’s too technical for you you can also create a cron job toward the cron url of your website.
Setup a simple url CRON job
Your WordPress’ site has a page which is dedicated to processing scheduled tasks.
If your site is mysite.com, the cron url will be mysite.com/wp-cron.php it may be different if your WordPress site is setup in a subfolder for instance mysite.com/subfolder/wp-cron.php
- now go to https://cron-job.org/
- Sign up for free and
- setup a cron job towards your site’s cron url.
Now be aware that this service will call your URL frequently, it can be up to once a minute.
It’s fine but certain hosting company may block those call with their in-house firewall, that’s the case of BlueHost for instance.
That’s it! Your scheduled tasks should run smoothly now.