How to Disable wp-cron in WordPress and Set Up Proper Cron Jobs

Are you having problems with scheduled actions not working in WordPress?

WordPress has a scheduling system called wp-cron, but it sometimes misses a scheduled task like publishing scheduled posts, sending triggered emails, etc. Proper cron jobs run by your server’s operating system are often more reliable.

In this article, we’ll show you how to disable wp-cron in WordPress, and cover two ways you can set up proper cron jobs.

How to Disable wp-cron in WordPress and Set Up Proper Cron Jobs

Why Disable wp-cron?

Your WordPress website has a built-in scheduling system called wp-cron. It performs time-sensitive tasks such as checking for updates, publishing scheduled posts, automatically creating regular backups, sending triggered emails, etc.

You can learn more in our guide on how to view and control WordPress cron jobs.

Viewing Scheduled Tasks in WordPress

The problem is that WordPress is only prompted to check for scheduled jobs when someone visits your website. This works well enough for most sites, but sometimes it can cause problems for smaller ones.

For example, if your site has low traffic, then your scheduled posts may not be published on time. And if your website gets a lot of traffic, then wp-cron will be checked frequently, which may impact your website’s performance.

Now if you just want to fix the missing scheduled posts error, then you can use the free plugin Missed Scheduled Publisher, but if you want to solve all scheduled action issues, then you need a real cron job.

A real cron job is run by your web hosting server’s operating system, not by WordPress. You can set it up to check for scheduled tasks more reliably. By default, WordPress doesn’t have access to set this up on the server level, but you can easily do it by following our tutorial.

With that being said, let’s take a look at how to disable wp-cron and set up a proper cron job. Here’s what we’ll cover in this tutorial:

Disabling wp-cron in WordPress

To disable wp-cron, you need to edit wp-config.php, which is a core WordPress configuration file. It’s located in your WordPress site’s root folder, and you will need to use an FTP client or the file manager in your web hosting control panel.

This file contains a lot of sensitive information, and making the wrong changes can break your WordPress site. We recommended making a backup of the file first, just in case. You can learn how by following our guide on how to edit wp-config.php in WordPress.

You’ll need to paste the following code into the wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’

define('DISABLE_WP_CRON', true);
Pasting Code into wp-config

After that, you need to save the file and upload it back to your website.

WordPress will no longer trigger wp-cron when someone visits your website.

Setting Up a Proper Cron Job on Your WordPress Host

Now you’ll need to set up a proper cron job to run your scheduled tasks. The way you do this will vary depending on the tools provided by your WordPress hosting provider.

The easiest way to set up cron jobs is using cPanel, a popular website control panel included with many web hosting plans, including Bluehost. We’ll use the Bluehost cPanel in this tutorial.

Note: Some web hosts don’t use cPanel and some may not even allow you to create cron jobs. If in doubt, you should contact your hosting provider or consult their support documentation. You can always use a third party cron service (below).

Once you log into your hosting account and navigate to cPanel, you should scroll down until you find ‘Cron Jobs’ and then click on it.

You may find it in the ‘Advanced’ section, but this can vary depending on your hosting provider.

Find 'Cron Jobs' in cPanel

This will take you to a new page where you can create new cron jobs.

Don’t worry about the warning you’ll see about needing a good knowledge of Linux commands. Only one command is necessary, and we’ll show you exactly what it is below.

The cPanel Cron Jobs Page

If you need to, you can change the email address where cron job notifications will be sent. The default address is the one you used when you signed up for your web hosting, and this will work fine on most websites.

Now, let’s scroll down to the ‘Add New Cron Job’ section and set up a cron job.

First, you need to decide how often the cron job will be run. This can be anything you like, but we recommend 30 minutes interval.

You will need to click the ‘Common Settings’ button and select a time interval from the dropdown. ’Twice Per Hour’ is a good choice for most sites if you’re not sure.

Creating a New Cron Job in cPanel

Now you can enter the command that will ask WordPress to run its scheduled tasks. You need to paste the following code into the ‘Command’ field:

wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Make sure you replace ‘example.com’ with your own website’s URL.

Once you’ve done that, make sure you click the ‘Add New Cron Job’ button, and you will see the new cron job added to the list below.

Viewing the List of Cron Jobs in cPanel

WordPress will now check for and run scheduled tasks every 30 minutes instead of when someone visits your website.

Setting Up a Proper Cron Job Using a Third Party Service

If your hosting plan doesn’t offer proper cron jobs, or they are difficult to set up, then you can use a third party cron service instead.

These are dedicated services that allow you to set up cron jobs using a simple interface. Here are a few of the better ones:

For this tutorial, we’ll use EasyCron because it is easy to use, and the free plan is suitable for most beginner use cases.

Once you create a free account, you can create a new cron job by clicking the ‘+ Cron Job’ button on the left.

Creating a New Cron Job in EasyCron

This will pop up the ‘Create Cron Job’ screen. First, you need to paste the following URL into the ‘URL to call’ field.

https://example.com/wp-cron.php?doing_wp_cron

Make sure you replace ‘example.com’ with your own site’s URL.

Creating a New Cron Job in EasyCron

After that, you should choose ‘Every 30 minutes’ from the ‘When to execute’ drop down. When you’re finished, don’t forget to click the ‘Create Cron Job’ button to store your settings.

The new cron job will be added to the list, and run wp-cron on your website every 30 minutes.

Viewing the List of Cron Jobs in EasyCron

We hope this tutorial helped you learn how to disable wp-cron in WordPress and set up proper cron jobs. You may also want to see our step by step guide to WordPress SEO, or check out our list of common WordPress errors and how to fix them.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Disable wp-cron in WordPress and Set Up Proper Cron Jobs first appeared on WPBeginner.

How to Fix the Missed Schedule Post Error in WordPress

Do you want to fix the missed schedule post error in WordPress?

WordPress comes with a built-in feature that allows you to easily schedule posts to be automatically published at a later time. However, sometimes you may notice that scheduled posts don’t get published at all.

In this article, we’ll show you how to easily fix the missed schedule post error in WordPress. This will allow you to ensure that your scheduled posts are published on time.

Fixing the missed schedule post error in WordPress

What Causes WordPress to Miss Scheduled Posts?

Your WordPress hosting environment or plugin conflicts may cause WordPress to miss scheduled posts.

Normally, when you schedule a WordPress post to be published later, WordPress uses a technology called ‘Cron’ or ‘WordPress Cron‘ to automatically publish your post on time.

However, if your WordPress hosting server or a plugin is affecting the cron jobs, then WordPress would miss the scheduled tasks such as publishing scheduled posts.

Missed schedule error for a blog post in WordPress

Your other cron jobs may still work occasionally like checking for updates or deleting auto-saved drafts. That’s because once the publishing time is missed WordPress will not publish the blog post on a different time.

For most users, it does not happen very often and for some users it can become a common WordPress issue.

That being said, let’s take a look at how to easily fix the missed schedule post error in WordPress.

Fixing The Missed Schedule Post Error in WordPress

First thing you need to do is install and activate the Missed Scheduled Post Publisher plugin. For more details, see our step by step guide on how to install a WordPress plugin.

The plugin works out of the box, and there are no settings for you to configure.

How does Missed Scheduled Post Publisher plugin work?

The plugin simply checks your website every 15 minutes to see if a scheduled WordPress post has missed schedule.

If it finds any missed schedule items, then it changes the status from scheduled to published.

It works for posts, pages, products, and any other custom post types that you may have on your WordPress website.

We built this plugin to ensure it doesn’t impact your WordPress site speed because we know speed is important for SEO. This is the plugin we’re using on our own sites.

Troubleshooting Missed Scheduled Posts Error in WordPress

If installing the plugin does not immediately fix scheduled posts error on your website, then the following are a few tips that you can try.

1. Check Your WordPress Timezone Settings

Setting your timezone is one of the first things to do after installing WordPress. However, sometimes users miss it and their WordPress timezone doesn’t match the timezone they want to use for publishing and managing their website.

Simply go to Settings » General page and scroll down to the ‘Timezone’ section. From here, you need to select your timezone or the timezone you want to use for your WordPress website.

Set timezone in WordPress

Don’t forget to click on the Save Changes button to store your settings.

2. Clear WordPress cache

If your WordPress posts are still missing schedule, then it is likely due to a poorly configured caching plugin. Try clearing WordPress cache and make sure that your WordPress caching plugin is properly configured to automatically clear cache at regular intervals.

3. Increase WordPress memory limit

Your WordPress website may be struggling with low memory limit issue. You can fix that by allowing WordPress to use more server memory which let’s WordPress run better.

Simply add the following code to your wp-config.php file ust before the line that says ‘That’s all, stop editing! Happy publishing.’

define('WP_MEMORY_LIMIT', '500M');

For details, see our guide on how to increase memory limit in WordPress.

We hope this article helped you learn how to easily fix the missed schedule post error in WordPress. You may also want to see our guide on how to easily troubleshoot WordPress errors on your own.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix the Missed Schedule Post Error in WordPress appeared first on WPBeginner.