Disabling WP-Cron: Executing WordPress Tasks via Real Cron Job
By default, WordPress uses the wp-cron.php file to execute scheduled tasks in the background. These include, for example, scheduled post publications, plugin and theme tasks, WooCommerce processes, email delivery, security scans, caching tasks, or automatic maintenance features.
The WordPress-native cron mechanism is called WP-Cron. Unlike a classic server cron job, however, WP-Cron does not automatically run at a fixed time. Instead, it is normally triggered by page views on your website. As soon as a visitor, a bot, or you yourself open a page, WordPress checks if any scheduled tasks are due.
For small websites, this principle often works flawlessly. On highly trafficked websites, however, WP-Cron can generate unnecessary server load. For websites with little traffic, the opposite can happen: scheduled tasks are executed late or not at all because nobody is visiting the website. A clean solution is therefore to disable WP-Cron and set up a real cron job in cPanel instead.
Only disable WP-Cron if you are truly going to set up a real cron job afterward. If WP-Cron is disabled but no replacement cron job is running, scheduled posts, backups, plugin tasks, WooCommerce actions, and other background processes may fail or be executed late.
What is WP-Cron?
WP-Cron is the internal task scheduling system of WordPress. It ensures that scheduled tasks are executed automatically. The name is inspired by classic cron jobs, but technically WP-Cron works differently than a real server cron job.
Typical tasks that run via WP-Cron are:
- publishing scheduled posts,
- executing automatic plugin, theme, or WordPress tasks,
- performing update checks,
- renewing or cleaning up cache files,
- starting backups, provided a backup plugin utilizes it,
- processing WooCommerce order processes or subscriptions,
- sending emails from queues,
- starting security or malware scans,
- cleaning up temporary data and transients.
WP-Cron is not fundamentally bad. It is a practical solution because it works without server configuration. However, for production websites, business-critical WordPress installations, or online shops, a real cron job is often more reliable.
Why Can WP-Cron Affect Performance?
With every page view, WordPress checks if a cron event is due. This check is normally small, but it can become noticeable with many visitors, many plugins, or many scheduled tasks. Websites with WooCommerce, membership plugins, backup plugins, security plugins, or extensive automations can be particularly affected.
There are two typical problem scenarios:
- High volume of visitors: WP-Cron can be checked very frequently and trigger additional PHP processes.
- Low volume of visitors: Due tasks are executed late because no page view is available as a trigger.
A real cron job solves both problems. It calls the WordPress cron file independently of visitors at a fixed interval, for example, every 15 or 30 minutes. This makes background tasks more predictable, and the website no longer needs to trigger this check during normal visitor views.
With a real server cron job, WordPress background tasks are executed in a controlled manner at fixed intervals. This can improve the response time of the website and simultaneously ensures that scheduled tasks are processed more reliably.
When Does a Real Cron Job Make Sense?
A real cron job is particularly recommended if your website regularly executes background processes or is critical for business. This applies, among others, to corporate sites, online shops, membership areas, course platforms, and websites with automated workflows.
Switching to a real cron job makes sense when:
- scheduled posts are published late,
- backups do not start reliably,
- WooCommerce tasks run with delays,
- email queues are not processed regularly,
- your website has many visitors,
- you use many plugins with background tasks,
- you suspect performance issues due to frequent cron executions,
- you want more control over scheduled WordPress tasks.
For very small websites with few plugins and normal traffic, WP-Cron is often sufficient. Nevertheless, a real cron job is a clean technical solution there too if you prefer reliable execution.
Step 1: Create a Backup
Before you make changes to wp-config.php, you should create an up-to-date backup of your website. The wp-config.php file is one of the most important WordPress configuration files. Incorrect changes can cause WordPress to stop loading properly.
Back up at least:
- the
wp-config.phpfile, - your WordPress files,
- the WordPress database.
If you are only making a minor change, in many cases it is sufficient to download the existing wp-config.php locally or duplicate it in the file manager before editing.
Step 2: Disable WP-Cron in wp-config.php
To prevent WordPress from executing WP-Cron during normal page views, you must set a constant in the wp-config.php file.
You can find the wp-config.php file in the root directory of your WordPress installation. This is usually where the folders wp-admin, wp-content, and wp-includes are located.
- Log in to your cPanel.
- Open the cPanel File Manager.
- Navigate to the root directory of your WordPress installation.
- Look for the
wp-config.phpfile. - Create a copy of the file or download it as a backup.
- Open the file for editing.
- Insert the following line above
/* That's all, stop editing! Happy publishing. */.
define('DISABLE_WP_CRON', true);
Then save the file. This will prevent WordPress from triggering WP-Cron automatically during normal page views.
Make sure not to insert the code at the very end after a closing PHP tag. In most WordPress installations, there is no closing
?> at the end of wp-config.php. The line belongs above the note That's all, stop editing!.Step 3: Set Up a Real Cron Job in cPanel
Once WP-Cron has been disabled, set up a real cron job in cPanel. This will automatically call the wp-cron.php file at a fixed interval.
- Log in to your cPanel.
- In the Advanced section, open the Cron Jobs menu item.
- Under Common Settings, choose a suitable interval.
- For many websites, every 15 minutes or every 30 minutes is sensible.
- Enter an appropriate cron job command in the Command field.
- Save the cron job.
A simple and frequently used variation is calling it via wget:
wget -q -O - https://yourdomain.ch/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Replace https://yourdomain.ch with your actual domain. Make sure you use the correct website address, i.e., with https:// and without typos.
Alternative Cron Job Commands
Depending on the hosting environment, different commands can be used. If wget is not available, curl often works as well:
curl -s https://yourdomain.ch/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Another option is a direct PHP call, provided the correct PHP path is known:
php /home/username/public_html/wp-cron.php >/dev/null 2>&1
The direct PHP call is technically clean, but it requires the complete server path to be correct. This path differs depending on the hosting account and installation directory.
For most CURIAWEB customers, the
wget call via the domain is the simplest and easiest solution to understand. If you are unsure which command is suitable for your website, CURIAWEB support will be happy to assist you.Which Interval Makes Sense?
The right cron job interval depends on what tasks your website performs. An interval of one minute is usually unnecessary for normal WordPress websites and can lead to high load. On the other hand, intervals that are too long can cause tasks to be executed very late.
| Website Type | Recommended Interval |
|---|---|
| Normal corporate website or blog | Every 30 minutes |
| Website with scheduled posts or regular plugin tasks | Every 15 to 30 minutes |
| WooCommerce shop or membership area | Every 5 to 15 minutes, depending on needs |
| Very active website with queues, bookings, or subscriptions | Every 5 minutes, if technically reasonable |
For many websites, every 15 minutes is a good compromise between reliable execution and resource-saving operation.
How to Test If WP-Cron Works
After setup, you should check whether scheduled tasks continue to be executed. The easiest way to test this is with a scheduled post publication or with a plugin that can display cron events.
Possible checks:
- Schedule a test post for the near future and check if it gets published.
- Verify that backup plugins continue to start automatically.
- Check WooCommerce actions, queues, or scheduled emails.
- Use a plugin to view scheduled cron events if necessary.
- Check in cPanel to ensure the cron job was saved correctly.
If tasks are not executed, first check the domain in the cron job command, the spelling of the wp-cron.php file, and the position of the line in wp-config.php.
Common Mistakes During Setup
When switching from WP-Cron to a real cron job, similar mistakes frequently occur. The following overview helps with troubleshooting.
- WP-Cron disabled, but no cron job set up: Scheduled tasks no longer run reliably.
- Incorrect domain in the command: The cron job calls the wrong website or an unreachable URL.
- HTTP instead of HTTPS: Use your website's correct HTTPS address where possible.
- Website blocked by maintenance mode: The cron call does not reach WordPress correctly.
- Security plugin blocks wp-cron.php: Some security rules may restrict access.
- Interval too short: Very frequent cron jobs can cause unnecessary load.
- Error in wp-config.php: A syntax error can impair WordPress.
Should wp-cron.php Be Publicly Accessible?
The wp-cron.php file is normally publicly accessible via your domain. This is common with WordPress because the cron call defaults to HTTP. If you employ special security rules, firewalls, or access restrictions, you should ensure that your own cron job can still call the file.
If a security plugin blocks access, scheduled tasks might stop running. In this case, you should specifically whitelist the cron call or switch to a direct PHP call via the server path.
Re-enabling WP-Cron
If you wish to return to the default WordPress function, remove the following line from wp-config.php again:
define('DISABLE_WP_CRON', true);
Then delete the cron job created in cPanel so that wp-cron.php is not called twice or unnecessarily.
Recommendation for CURIAWEB Customers
For professional WordPress websites, we recommend replacing WP-Cron with a real cron job. This approach is more reliable and technically cleaner, particularly for WooCommerce, backup plugins, security plugins, membership areas, or websites with scheduled publications.
At CURIAWEB.CH, you can set up the cron job directly in cPanel. For most websites, an interval of 15 or 30 minutes is suitable. Online shops or websites with many time-critical tasks may require a shorter interval.
Frequently Asked Questions About WP-Cron and Real Cron Jobs
What happens if I disable WP-Cron?
WordPress will no longer automatically trigger scheduled tasks during page views. Therefore, a real cron job must be set up to call wp-cron.php regularly.
How often should the cron job run?
For normal websites, 15 to 30 minutes is usually enough. For WooCommerce, membership areas, or time-critical tasks, 5 to 15 minutes can make sense.
Does disabling WP-Cron always improve performance?
Not always noticeably, but technically it is often cleaner. The biggest advantage lies in the controlled and more reliable execution of scheduled tasks.
Can I delete wp-cron.php completely?
No. The wp-cron.php file should not be deleted. It will still be called by the real cron job. Only the automatic trigger during normal page views is disabled.
Is a real cron job recommended for WooCommerce?
Yes. WooCommerce and many extensions use scheduled tasks for orders, emails, subscriptions, inventory processes, or queues. A real cron job can ensure more reliability here.
Maximum Stability for Your WordPress Website
With CURIAWEB.CH, you benefit from high-performance WordPress hosting with a Swiss server location, cPanel management, and personal support.
To WordPress Hosting PlansAre you unsure about setting up the cron job? Our CURIAWEB Support is happy to help you further.