Are your scheduled posts not being published on time? Automatic backups failing for no apparent reason? Do you notice that your website slows down at certain times? The culprit could be WordPress' scheduled task system, known as WP-Cron. Although its name suggests it, it's not a "real" cron, and in this guide we'll show you how to fix it once and for all. In my experience developing WordPress for more than 8 years, learning to set up a real WP Cron is one of the most important steps to achieve a more reliable, fast and professional website.
What is WP-Cron and Why is it not a "Real Cron"?
To understand the solution, we must first understand the problem. A traditional "cron job", in the context of servers (such as Unix/Linux), is a scheduled task that runs at exact, predefined times. For example, you can tell the server to run a script every day at 3:00 AM, and it will do it with military precision, no matter what.
However, the system that WordPress uses, WP-Cronworks in a very different way. During my years as a PHP developer, I have seen how this limitation especially affects e-commerce sites where stock synchronizations must be accurate. WP-Cron is not a real cron, but a simulation. Its great weakness is that is only activated when someone visits your website.
This is how it works:
- Every time a page is loaded on your site (either in the frontend or in the admin panel), WordPress executes the script
wp-cron.php. - This script checks the list of scheduled tasks (publications, backups, updates, etc.).
- If it finds a task whose execution time has already passed, it executes it.
The Fundamental Problem of WP-Cron
If your website has little or no traffic during the night, no task scheduled for that period (such as a nightly backup) will run until the first visitor arrives in the morning. This makes WP-Cron an unreliable system for critical tasks.
The Dangers of Relying on WP-Cron by Default
Relying on the default WordPress system can bring with it several problems, which are compounded depending on the type of site you manage. I've worked with clients who have lost sales due to failed syncs, and others who have had their SEO degraded by content that wasn't published when it should have been:
- Null Reliability in Sites with Low Traffic: As we've already seen, if no one visits your site, the tasks don't run. In the WordPress projects I've developed, this has been especially problematic for e-commerce that need to synchronize stock or for blogs that schedule content during off-peak hours.
- Performance Impact on High Traffic Sites: At the other extreme, if your web site receives thousands of visits, the script
wp-cron.phpwill run on each of them. Although the check is fast, these thousands of unnecessary executions add extra load and consume server resources that could be used to serve content to your users faster. - Unexpected Delays: Tasks are not executed "at 10:00", but "the next time someone visits the site after 10:00". This can cause delays of minutes or hours.
Methods to Configure a Real WP Cron
There are several methods to implement a real cron in WordPress, from simple solutions to more technical implementations. My approach to increasing revenue for my clients always includes this optimization, as reliability in scheduled tasks is crucial for any online business.
Method 1: Traditional Manual Configuration
This is the most universal method and the one that works in virtually any hosting environment.
Step 1: Deactivate WP-Cron by default
To prevent WordPress from running wp-cron.php on each visit, we must deactivate it. When I develop custom plugins, I always recommend this step as fundamental. To do this, we need to edit the wp-config.php.
Attention! Before editing the file wp-config.phpIf you do not make a backup copy of this file, it is essential that you make a backup copy of it. An error in this file can cause your website to stop working.
Connect to your server through an FTP client (such as FileZilla) or use the File Manager of your hosting panel (cPanel, Plesk, etc.).
2. Locate the file wp-config.php in the root directory of your WordPress installation.
3. Download it, edit it with a plain text editor (such as VS Code, Sublime Text or Notepad) and add the following line just before the line that reads /* That's it, stop editing! Happy blogging. */:
define('DISABLE_WP_CRON', true);4. Save the changes and upload the file back to your server, overwriting the original.
Step 2: Create a Real Cron Job at Server Level
Now that WordPress is no longer in charge of launching the tasks, we must configure our server to do so. Most hosting panels (cPanel, Plesk, etc.) have a section called "Cron Jobs" or "Scheduled Tasks".
The command you need to use is usually one of these two:
Option 1 (with wget):
wget -q -O - https://tudominio.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1Option 2 (with curl):
curl -s https://tudominio.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1How often should I run the Cron Job?
In my experience developing WordPress, a standard and recommended configuration is every 15 to 30 minutes. This frequency ensures that tasks run on time without overloading the server. For high traffic sites, I have used 5 minute intervals with no problems.
Method 2: WordPress Toolkit (Plesk)
If your hosting uses Plesk with WordPress Toolkit, you have a much simpler option. In the projects I manage on servers with Plesk, I always use this functionality for its simplicity:
- Login to your Plesk panel
- Go to "WordPress Toolkit".
- Select your WordPress installation
- In the "Security" section, look for the "Take over wp-cron" option.
- Activate this option
That's it! WordPress Toolkit automatically:
- Deactivate the internal WP-Cron by adding
DISABLE_WP_CRONto yourwp-config.php - Set up a system cron job to run tasks every 5 minutes
- Manage all settings without having to touch code
Method 3: Softaculous
Softaculous, the popular script installer that many hosts include, also offers an option to manage WP-Cron. During my years as a PHP developer, I have found this to be an excellent option for those who are not comfortable editing files manually:
- Login to your hosting control panel (cPanel, DirectAdmin, etc.)
- Go to the section "Softaculous Apps Installer".
- Find your WordPress installation in "Current Installations".
- Click on "Edit Details" or the configuration icon.
- Look for the option "Disable WP-Cron" or "Disable WP-Cron".
- Activate this option
Like WordPress Toolkit, Softaculous automatically performs a "takeover" of the cron system, configuring everything necessary without manual intervention.
Method 4: Deployment with Docker
What I have learned working with Docker containers is that cron management requires a specific approach. There are several strategies for implementing a real cron with Docker:
Option 1: Cron on Host Server (Recommended)
This is the simplest option and the one I usually recommend in my projects. We configure the crontab directly on the host server:
# Run every 5 minutes
*/5 * * * * * * * docker exec container_name_wordpress curl -s http://localhost/wp-cron.php?doing_wp_cron >/dev/null 2>&1O using wget:
# Run every 5 minutes
*/5 * * * * * * docker exec wordpress_container_name wget -q -O - http://localhost/wp-cron.php?doing_wp_cron >/dev/null 2>&1Option 2: Integrating Cron into WordPress Container
For projects where I need more integration, I modify the PHP container to include dcron. This requires a custom Dockerfile:
FROM wordpress:php8.2-apache
# Install dcron
RUN apt-get update && apt-get install -y cron
# Add cron job
RUN echo "*/5 * * * * * * www-data curl -s http://localhost/wp-cron.php?doing_wp_cron >/dev/null 2>&1" >> /etc/crontab
# Start cron on container startup
RUN service cron startOption 3: Dedicated Container for Cron
In more complex architectures, I use a dedicated container exclusively to handle cron tasks. This approach is useful when I manage multiple WordPress sites:
# docker-compose.yml
version: '3.8
services:
wordpress:
image: wordpress:latest
# ... WordPress container configuration
wp-cron:
image: alpine:latest
command: |
sh -c "
apk add --no-cache curl
echo '*/5 * * * * * curl -s http://wordpress/wp-cron.php?doing_wp_cron >/dev/null 2>&1' > /etc/crontabs/root
crond -f
"
depends_on:
- wordpressVerification and Management with WP Crontrol
After implementing any of the above methods, I always install the plugin WP Crontrol to verify that everything is working correctly. In my experience developing WordPress, it is the most reliable tool for monitoring the cron system.
Once installed and activated, go to Tools → Cron Events for:
- View a list of all scheduled cron events
- Check your "Next Run" to confirm that the actual cron is running
- Execute any task manually
- Manage customized events
Frequently Asked Questions (FAQ)
What if my hosting does not give me access to cron jobs?
If your hosting plan is very basic and does not allow you to set up cron jobs, I have worked with customers who have used external services such as EasyCron or UptimeRobot to make periodic HTTP calls to wp-cron.php. However, my recommendation is always to migrate to a higher quality hosting.
Will deactivating WP-Cron affect the performance of my plugins?
On the contrary, it will improve it. During my years as a PHP developer, I have seen how this optimization solves synchronization problems and improves the user experience. Plugins will still schedule their tasks normally, they will just run more reliably now.
How do I know if my real cron is working properly?
In addition to WP Crontrol, in my projects I implement custom logging to monitor the execution of critical tasks. I also use tools like New Relic or custom monitoring for real time alerts.
Conclusion: Take Ultimate Control of Your WordPress
Moving away from relying on the WordPress pseudo-crony is a maturity step in managing any serious website. In my experience developing WordPress, this optimization has been key to increasing my clients' revenue by ensuring that all business-critical functionality works when it should.
Whether using WordPress Toolkit, Softaculous, manual configuration, or Docker deployments, the goal is the same: reliability, performance and professionalism. Choose the method that best suits your technical environment and give your WordPress the stability it deserves.
If you have any doubts about the implementation in your specific environment, remember that you can always consult the official WordPress documentation or contact your hosting technical support for specific help.
