Home Website TutorialsWordPress Fix the “The following scheduled events failed to run” error

Fix the “The following scheduled events failed to run” error

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

In this tutorial, AZDIGI will show you how to solve the “The following scheduled events failed to run” error when using WordPress.

Click on the AZDIGI website to refer to the best hosting/VPS service in Vietnam.

I. Introduction

WordPress has a feature called WP Cron. WP Cron is a built-in function for automation purposes that allows the scheduling of automated tasks, such as:

  • As published post.
  • Maintenance task.
  • Check for updates.
  • And there will be many plugins that need to use this feature to perform their tasks.

However, WP-Cron is not a real Cron Job, you can understand it as a “fake Cron Job“. These tasks are only fired when someone visits your website, while the PHP page loads, WP-Cron will check the database to see if there are any scheduled tasks to execute.

The way WP-Cron works has some disadvantages: When you are using a website acceleration plugin with caching like WP-Rocket, no PHP will be executed in the UI, so if you don’t If there is any activity on WP-Admin for a while, the WP-Cron processes will be deactivated.

This is also a potential problem on high-traffic sites, as every request can create a process that uses server resources, and the WP-Cron WP-Cron feature can be used as a target of a DDOS attack..

And once WP-Cron cannot work, the error “The following scheduled events failed to run” will appear.

So in this article, AZDIGI will show you how to fix the “The following scheduled events failed to run” error as well so that we no longer depend on WP-Cron.

II. How to detect the error “The following scheduled events failed to run”

How to detect the error “The following scheduled events failed to run” is very simple, you just need to access the following link:

AZDIGI Tutorial
http://domain.com/wp-admin/tools.php?page=action-scheduler
    

Remember to change domain.com to your domain.

When accessing this link, if WP-Cron‘s scheduler events are not working, you will immediately see this message at the top.

However, even if you don’t get the “The following scheduled events failed to run” error, you should follow the steps in this article to reduce the risk of abusing WP-Cron to DDOS your website.

III. Fix the “The following scheduled events failed to run” error

To fix the “The following scheduled events failed to run” error, we follow these 2 steps.

Step 1: Disable WP-Cron

Because the disadvantages of WP-Cron are too many, please disable it and create a real Cron Job to use.

But before creating a real Cron Job, we need to disable WP-Cron first. To disable WP-Cron, you need to edit the file wp-config.php of your website.

AZDIGI Tutorial
define('DISABLE_WP_CRON', true);
    

With just such an operation, we have successfully disabled WP-Cron. We continue to step 2 to create a real Cron Job for your website.

Step 2: Add Cron Job to your WordPress website

This is very simple, popular Control Panels such as DirectAdmin or cPanel have fully supported Cron Job right on the user interface.

a. For cPanel:

On the cPanel interface, search with the keyword “cron” and find the Cron Jobs feature in the Advanced section.

how to fix The following scheduled events failed to run

At the Cron Jobs interface, you just need to enter the following information:

how to fix The following scheduled events failed to run
Everything will be automatically checked every 5 minutes instead of every time a user visits the website.

For the content at Command, you will need to enter the following information:

AZDIGI Tutorial
wget -q -O - http://domain.com/wp-cron.php?doingwpcron >/dev/null 2>&1
    

Remember to change domain.com to your domain. Next, click Add new Cron Job to finish.

b. For DirectAdmin:

Similar to cPanel, but the location of the Cron Jobs feature will be in the Advanced Features section.

how to fix The following scheduled events failed to run

Then, click Create Cron Job. and enter the following information:

how to fix The following scheduled events failed to run
Everything will be automatically checked every 5 minutes instead of every time a user visits the website.

For the content at Command, you will need to enter the following information:

AZDIGI Tutorial
wget -q -O - http://domain.com/wp-cron.php?doingwpcron >/dev/null 2>&1
    

Remember to change domain.com to your domain. Next, click Create to complete.

At this point, you can go back to check the error “The following scheduled events failed to run” no longer exists.

III. Summary

With two simple steps, we have fixed the “The following scheduled events failed to run” error on WordPress. However, even if your website does not have this error, we should replace WP-Cron with a real Cron Job to be able to limit DDOS attacks targeting the WP-Cron feature.

Wishing you success!

See more useful website tutorial articles at the following link:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign