WP Crontrol

外掛說明

WP Crontrol lets you view and control what’s happening in the WP-Cron system. From the admin screens you can:

  • View all cron events along with their arguments, recurrence, callback functions, and when they are next due.
  • Edit, delete, and immediately run any cron events.
  • Add new cron events.
  • Bulk delete cron events.
  • Add, edit, and remove custom cron schedules.

The admin screen will show you a warning message if your cron system doesn’t appear to be working (for example if your server can’t connect to itself to fire scheduled cron events).

Usage

  1. Go to the Tools -> Cron Events menu to manage cron events.
  2. Go to the Settings -> Cron Schedules menu to manage cron schedules.

螢幕擷圖

  • New cron events can be added, modified, deleted, and executed.
  • New cron schedules can be added, giving plugin developers more options when scheduling events.

常見問題集

What’s the use of adding new cron schedules?

Cron schedules are used by WordPress and plugins for scheduling events to be executed at regular intervals. Intervals must be provided by the WordPress core or a plugin in order to be used. As an example, many backup plugins provide support for periodic backups. In order to do a weekly backup, a weekly cron schedule must be entered into WP Crontrol first and then a backup plugin can take advantage of it as an interval.

How do I create a new PHP cron event?

In the Tools -> Cron Events admin panel, click on the “Add PHP Cron Event” tab underneath the cron event table. In the form that appears, enter the schedule and next run time in the boxes. The event schedule is how often your event will be executed. If you don’t see a good interval, then add one in the Settings -> Cron Schedules admin panel. In the “Hook code” area, enter the PHP code that should be run when your cron event is executed. You don’t need to provide the PHP opening tag (<?php).

How do I create a new regular cron event?

There are two steps to getting a functioning cron event that executes regularly. The first step is telling WordPress about the hook. This is the part that WP Crontrol was created to provide. The second step is calling a function when your hook is executed.

Step One: Adding the hook

In the Tools -> Cron Events admin panel, enter the details of the hook. You’re best off having a hookname that conforms to normal PHP variable naming conventions. The event schedule is how often your hook will be executed. If you don’t see a good interval, then add one in the Settings -> Cron Schedules admin panel.

Step Two: Writing the function

This part takes place in PHP code (for example, in the functions.php file from your theme). To execute your hook, WordPress runs an action. For this reason, we need to tell WordPress which function to execute when this action is run. The following line accomplishes that:

add_action( 'my_hookname', 'my_function' );

The next step is to write your function. Here’s a simple example:

function my_function() {
    wp_mail( 'hello@example.com', 'WP Crontrol', 'WP Crontrol rocks!' );
}
Which users can manage cron events and schedules?

Only users with the manage_options capability can manage cron events and schedules. By default, only Administrators have this capability.

Which users can manage PHP cron events?

Only users with the edit_files capability can manage PHP cron events. By default, only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.

Are any WP-CLI commands available?

The cron commands which were previously included in WP Crontrol are now part of WP-CLI (since 0.16), so this plugin no longer provides any WP-CLI commands. See wp help cron for more info.

使用者評論

2019 年 4 月 25 日
Makes it very easy to see all of the cron events from the wp-admin UI on a site, then modify those cron events run time if needed.
2019 年 3 月 17 日
My thanks for a great plugin, I use it everyday to help confirm our WordPress site's security is still in integrity by checking our cron job queue. Additionally it is easy to change cron job run times, which is very useful. It works great and the functionality is much appreciated. Alastair
2019 年 2 月 6 日
I was an hour into a weird cron problem when I downloaded this plugin. Within seconds I saw the error message "Error calling spawn_cron (HTTP 401)". This perfect feedback told me the problem was with the password-protection on my site, and the problem was solved in a couple of minutes.
2019 年 1 月 9 日
This plugin broke editing posts and redirecting, even though it should not have anything to do with it.
2018 年 12 月 30 日
So convenient to debug cron jobs or clean them when some plugins end up scheduling way to many crons (bug).
閱讀全部 85 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈WP Crontrol〉的開發相關工作。

參與者

WP Crontrol 外掛目前已有 8 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將 WP Crontrol 外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

For WP Crontrol’s changelog, please see the Releases page on GitHub.