Ticker

6/recent/ticker-posts

Ad Code

Responsive Advertisement

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance?

Scheduled actions not working in WordPress? WordPress has a scheduling system called p-cron, but sometimes it misses scheduled tasks, publishes, truncates triggered scheduled posts, etc. In this article, we’ll show what is WP-Cron and why you should disable WordPress cron jobs for faster performance?

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance?

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance?

What is wp-cron?

Wp-cron is a file/resource responsible for controlling the time-sensitive tasks of your WordPress site. For example, let’s say you’ve scheduled a post for next Wednesday at 9:30 am. Wp-cron makes sure this happens on time (or at least as close to “on time” as possible – more on that in a second).

In addition to ensuring that core WordPress features work, many WordPress plugins rely on wp-cron to handle scheduling sensitive parts of the plugin.

If you want to view all the scheduled tasks on your website, you can use a free plugin like WP-Control. For example, if you go to Tools → Cron Events, you can see all the automatic tasks that WordPress has scheduled to run and how often they run.

As the name suggests, wp-cron comes from the more general cron scheduling system used by Unix operating systems. However, wp-cron is different from these scheduling systems, and wp-cron is not a real cron job.

The big difference is that wp-cron only runs when you or someone else visits your site (either on the front end or your dashboard). WordPress will run the wp-cron.php file whenever someone visits your site and check the scheduled tasks. If there is a task, it will perform it.

Why disable WP-Cron?

Your WordPress site has a built-in scheduling system called wp-cron. It creates tasks that run automatically, sends on time, checks for updates, publish scheduled posts, automatically regular backups, sends triggered emails, etc.

Moreover, you can learn more in our guide on viewing and controlling WordPress cron jobs.

The problem is that WordPress is only asked to check scheduled jobs when it visits your site. This works well enough for most websites but can sometimes cause problems for smaller ones.

And for example, if your site has low traffic, your schedules may not be published on time. And lots of traffic, wp-cron will be checked frequently, which can improve your website performance.

Now, if you just want to solve the scheduled action error, you don’t want to solve the problem, but if you don’t want to solve all of the issues of a real cron.

The real cron job is run by your web hosting server’s operating system, not WordPress. You can configure it to check tasks more reliably. By default, WordPress does not have permission to configure at the server level, but you can easily follow our tutorial.

With that out, let’s do some configuration like disabling w and setting up a cron. Here’s what we’ll cover in this tutorial:

  • Disable wp-cron in WordPress
  • Set up a suitable cron job on your WordPress hosting
  • Configure cron jobs with custom third-party services

Disable cron jobs in WordPress 

To disable WordPress cron jobs, you need to edit the core WordPress configuration file, wp-config.php. It’s on your WordPress site and can be the root file manager for your FTP client or the file manager for your web hosting control panel. 

This file contains many information and errors to complete your WordPress site. To disable WP-Cron for confirmation, it is recommended to back up the files first. Then you can follow the guide on how to edit wp-config.php in WordPress.

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

define(‘DISABLE_WP_CRON’, true);

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance?

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

WordPress will no longer trigger wp-cron when visiting your site.

Set up the appropriate cron jobs in WordPress hosting

Now configure a cron job to run your scheduled task. Moreover, how you do this depends on your WordPress hosting provider’s tools.

And the easiest way to set up a cron job is to use cPanel, a website control panel popular with many web hosting plans, including Bluehost. We will be using Bluehost cPanel for this tutorial.

Note: Some web hosts do not use cPanel, and some may not even allow you to cry cron tasks. If you doubt, contact your hosting provider or consult their support documentation. Of course, you can always use a third-party cron service (below).

After logging into your hosting account and navigating to cPanel, you must scroll down until you find ‘Cron Jobs’ and click on it.

You can find us in the ‘section, but this can go forward to your hosting provider.

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance

Find ‘Cron Jobs’ in cPanel.

This you can create a new page of new cron jobs.

You don’t have to worry about warnings that require a good knowledge of Linux commands. Moreover, only one order is necessary, showing precisely what is below.

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance?

And if you need to, you can change the email address where and will send cron job notifications. The default address you use when you sign up for your web hosting will work fine on most websites.

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

First, you need December to determine how often the cron job will run. And this can be whatever you want, but we recommend a 30-minute break.

You must click the ‘Common Settings’ button and select a time range from the drop-down menu. If you’re not sure, it’s a good idea to select “Twice an hour” for most sites.

Creating a new cron job in cPanel

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance

You can now type the command asking WordPress to run your scheduled tasks. Moreover, you need to paste the following code into the ‘Command’ field:

wget -q -O – https://ift.tt/9EcmKLj >/dev/null 2>&1

Be sure to replace ‘example.com’ with your own website’s URL.

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

What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance

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

Use a third-party service to set up the appropriate cron job

If your hosting plan doesn’t offer adequate cron jobs or is challenging to configure, you can use a third-party cron service.

These dedicated services allow you to configure cron jobs using a simple interface. Here are some of the best:

  • EasyCron has a free plan that needs to be renewed monthly cron-job.org is a free service 
  • Creditors are free if you only need a cronjob 
  • SetCronJob offers paid plans starting at $ 10 per year 
  • This tutorial uses EasyCron.

This is because it is easy to use, and the free plan is suitable for most beginner use cases.

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

Creating a new cron job in EasyCron

Creating in EasyCron

This will open the ‘Create Cron Job’ screen. First, paste the following URL into the ‘URL to call’ field.

https://ift.tt/9EcmKLj

Be sure to replace ‘example.com’ with your own website’s URL.

Creating in EasyCron

Afterward, you must choose ‘Every 30 minutes from the ‘When to run’ drop-down menu. When you’re done, don’t forget to click the Create Cron Job button to save your settings.

A new cron job is added to the list, and the site also runs wp-cron every 30 minutes.

Viewing the cron task list in EasyCron

Creating in EasyCron

A new cron job is added to the list, and the site also runs wp-cron every 30 minutes. You might also want to see our step-by-step guide to WordPress SEO or check out our list of common WordPress mistakes and how to fix them.

The post What Is WP-Cron And Why You Should Disable WordPress Cron Jobs for Faster Performance? appeared first on Visualmodo.

Enregistrer un commentaire

0 Commentaires