Why WP-Cron is Important to know as a Website Owner
Published March 23, 2023
With how necessary websites are nowadays to business owners in creating their brand and reputation, it is important to always be side by side with the designers and developers in creating a full image of what they are, starting from the bigger picture to the smallest of details. Every detail counts and today we will talk about a small feature in WordPress that actually has a huge effect on website performance, WP-Cron.
What is WP-Cron?
WP-Cron is a feature in WordPress with a primary function of setting up scheduled or time-sensitive tasks. This makes it important because many of the things done in a website are triggered and time related from scheduling posts or publications to checking for theme and plugin updates to proper website management like deleting old comments from the trash. It is therefore a function that is actually used in all websites albeit WP-Cron is specifically made as a feature in WordPress.
There are actually general/regular cron jobs that are used by the other development software but these run based on server-specific requirements and server settings. With WP-Cron, this function runs every time someone visits the WordPress powered website which allows it to run properly in different kinds of server set-ups.
WP-Cron function also runs continuously once it’s triggered through page visits and requests and it will continue to run until all the tasks are completed based on the execution time set in the server configuration.
What is wrong with WP-Cron?
So what is the problem? WP-Cron sounds very automated and self-serving making it look like a great feature that does not need any mind. This is because unlike regular cron jobs, it does not need manual set-ups so it is left alone. But sadly, there are critical flaws in this function.
High Traffic Websites
As mentioned above, WP-Cron runs continuously once a request has been triggered to WP-cron.php (This would be considered its script and not as a separate entity) at a certain amount of time. With high-traffic websites, this becomes a problem because the trigger is based on every page visit so a request is made per user and the cron would be running multiple processes simultaneously and using a lot of server resources. If the server manages a lot of WordPress sites for instance, this can cause the websites to slow down in terms of page loading or can ultimately make the site crash.
Trigger Post
Right above we talked about problems WP-Cron faces for high traffic websites but it actually also has problems as well with low traffic websites. Because WP-Cron is triggered and only runs when there is a page visit, this will not function and scheduled posts will not push through if there are no page requests. This makes the website stagnant and will possibly delay the necessary jobs that it should be doing on a daily basis especially on plug-in updates.
What can we do?
Ironically, the great solutions it’s known for can actually be the source of its problems, but there is a way to save it. The solution is actually configuration by setting up cron jobs in Linux. With this, the developers would first disable the WP-Cron function that would allow it to automatically execute on page load and set up a request to WP-Cron.php not based on trigger but at regular intervals and website owner preference.
Why does this happen?
With the features of the WP-Cron function, there is no wonder that this can be overlooked. Because of this, when there are problems on the website’s performance, this function not usually considered the culprit at first glance. Although if you do a quick search on the web, there are many articles that talk about properly setting up and avoiding the problems of WP-Cron.
Getting the right hosts
In conclusion, to avoid these issues quickly, it is necessary to get a well-versed web team. As business owners, although this might be a small detail, it can create huge headaches especially if one of the technical website goals is to have high traffic and great website performance. This is why it is important to get proper web maintenance and hosting with developers that look at the nitty-gritty and do proper research. It is also important to be able to have close relations with your expert tech guy who can tell you the real problem and make the right moves rather than an amateur that uses the process of elimination in almost every issue.
We see the importance of sharing these intricate details to business owners so when problems do arise, both parties are more involved in the solution. They can also keep this in mind when choosing which hosting to go for.
Need help or don’t want to tackle this by yourself? No worries, reach out to us and one of our experts can assist you!
References:
(2021). WPbeginner: Beginner’s Guide for WordPress. How to View and Control WordPress Cron Jobs
Chouhan, H. (2012) Envatotuts+. Insights into WP-Cron: An Introduction to Scheduling Tasks in WordPress.
Design Source Media