説明
WP Crontrol を使用すると、WP-Cron システムで起こっていることを表示して制御できます。 管理画面から、以下を実行できます。
- 引数、スケジュール、コールバック関数、そして次回の予定時期とともに、すべての cron イベントを表示します。
- Cron イベントの編集、削除、一時停止、再開、即時実行が可能。
- 新しい Cron イベントの追加。
- cron イベントの一括削除
- 任意の cron スケジュールの追加と削除
- Cron イベントリストを CSV ファイルとしてエクスポート、ダウンロードすることができます。
WP Crontrol はタイムゾーンを認識し、アクションが無かったり、スケジュールを逃したイベントを警告し、Cron システムで何らかの問題を検出した場合、役立つ警告メッセージを表示します。
使い方
- Cron イベントを管理するには、
ツール -> Cron イベント
メニューに移動します。 - cron スケジュールを管理するには、
設定 -> Cron スケジュール
メニューに移動します。
他のプラグイン
他にも開発者向けのプラグインをいくつか管理しています。ぜひご覧ください。
- Query Monitor は WordPress 開発者向けのツールパネルです。
- User Switching は、WordPress のユーザーアカウントを瞬時に切り替えることができます。
個人情報の取り扱いについて
WP Crontrol は、デフォルトでプライベートであり、常にプライベートです。第三者にデータを送信することもなく、第三者のリソースを含むこともありません。
WP Crontrol の個人情報の取り扱いについての全文はこちらでご覧いただけます。.
アクセシビリティに関する声明
WP Crontrol は、すべてのユーザーにとって完全にアクセス可能であることを目指しています。ウェブアクセシビリティのベストプラクティスを実装し、セマンティックで構造化されたマークアップを出力し、WordPress のデフォルトスタイルとアクセシビリティガイドラインを遵守し、WordPress とウェブブラウザが提供するアクセシビリティ API を適切に使用し、キーボードとモバイルデバイスを介して完全にアクセスできるようにします。
WP Crontrol は、管理領域自体がこれらのガイドラインに準拠している最新バージョンの WordPress で使用する場合、レベル AA の Web コンテンツ アクセシビリティ ガイドライン (WCAG) 2.0 に準拠する必要があります。WP Crontrol でアクセシビリティの問題を経験したり特定した場合は、WP Crontrol プラグイン サポート フォーラムでスレッドを開いてください。迅速に対応いたします。
スクリーンショット
FAQ
-
このプラグインは、PHP 8 で動作しますか?
-
はい、積極的にテストされ、PHP 8.2 まで動作しています。
-
「サイトの WP-Cron システムへの呼び出しが頻発する問題がありました。」というエラーが表示されます。どうすればいいですか?
-
cron イベントがスケジュールに間に合わないことがあるのはなぜですか?
-
cron イベントを削除しても、すぐに元に戻ることがあるのはなぜですか?
-
イベントがプラグインによって追加された場合、プラグインは、イベントが欠落していることを確認するとすぐにイベントを再スケジュールした可能性があります。 これを回避するには、代わりに「このフックを一時停止する」アクションを使用できます。これは、一時停止しますが、実行時にアクションを実行しないことを意味します。
-
cron イベントを削除しても大丈夫ですか?
-
これは完全にイベントに依存します。お気に入りの検索エンジンでイベント名を検索すると、そのイベントがどのプラグインに属しているかがわかりますので、その上で削除するかどうかを判断してください。
イベントのアクションが「なし」と表示されている場合は、通常は削除しても問題ありません。アクションのないイベントの詳細については、他の FAQ を参照してください。
-
一部の cron イベントを削除できないのはなぜですか?
-
WordPress コアソフトウェアは、その機能の一部に cron イベントを使用しており、これらのイベントを削除すると WordPress がすぐに再スケジュールしてしまうため、削除することはできません。このため、WP Crontrol では、WordPress コアからこれらの永続的なイベントを削除することはできません。
これらのイベントを実行したくない場合は、代わりに「このフックを一時停止」アクションを使用できます。
-
イベントを一時停止するとどうなりますか?
-
イベントを一時停止すると、イベントのフックに関連付けられているすべてのアクションが無効になります。 イベント自体はそのまま残り、スケジュールに従って実行されますが、そのフックに関連付けられたすべてのアクションは無効になります。 これにより、イベントは動作しなくなりますが、欠落している場合に自動的に再スケジュールされるイベントとの完全な互換性を維持するためにスケジュールされたままになります。
イベントを一時停止すると、実際にはそのフックが一時停止するため、イベントを一時停止して再開すると、同じフックを使用するすべてのイベントが一時停止または再開されます。 これは、個々のイベントを個別に一時停止するよりもはるかに便利で信頼性があります。
-
イベントを再開するとどうなりますか?
-
イベントを再開すると、イベントのフックに関連付けられているすべてのアクションが再び有効になります。 同じフックを使用するすべてのイベントが再開されます。
-
cron イベントのアクションに「なし」が表示されているのはどういう意味ですか?
-
これは、cron イベントが指定された時間に実行されるようにスケジュールされているが、イベントが実行されたときにトリガーされる機能がないため、イベントが役に立たないことを意味します。
これは、プラグインを無効にしたときに、その cron イベントをクリーンアップしないプラグインが原因であることが多いです。お気に入りの検索エンジンを使ってイベント名を検索すると、どのプラグインに属しているかがわかりますので、その上で削除するかどうかを決めてください。
-
cron イベントの次の実行時間や再帰性を変更するにはどうすればいいですか?
-
イベントの横にある「編集」リンクをクリックすると、cron イベントの時間や頻度を変更することができます。
-
URL をリクエストする cron イベントを作成するにはどうすればいいですか?
-
ツール → Cron イベント → 新規追加の画面から、WordPress の HTTP API を使って URL を取得する PHP を含んだ cron イベントを作成します。例えば、以下のようになります。
wp_remote_get( 'http://example.com' );
WP Crontrol wiki で、PHP Cron イベントの機能とセキュリティに関するすべてを読むことができます。
-
cron イベントに変更を加えても保存されないのはなぜですか?
-
cron イベントのリストをエクスポートすることはできますか?
-
はい、cron のイベント一覧画面の「エクスポート」ボタンから、イベント一覧の CSV ファイルをエクスポート、ダウンロードできます。このファイルは任意の表計算アプリケーションで開くことができます。
-
自サイトで実行されたすべての cron イベントの履歴ログを見ることはできますか?
-
まだですが、近いうちにこの機能を追加したいと考えています。
-
cron イベントやスケジュールの編集・追加・削除の履歴ログを見ることはできますか?
-
はい。優れた Simple History plugin には、WP Crontrol 経由で実行されたアクションのログを取るためのサポートが組み込まれています。
-
新しい cron スケジュールを追加しどの様に使用しますか?
-
Cron のスケジュールは、定期的に実行されるイベントをスケジュールするために WordPress やプラグインで使用されます。 イベントの間隔は、WordPress コアまたはプラグインによって提供され、使用される必要があります。 たとえば、多くのバックアッププラグインは定期的なバックアップをサポートしています。 毎週のバックアップを行うには、WP Crontrol に毎週の cron スケジュールを入力すると、バックアッププラグインはイベントの間隔としてそれを利用できます。
-
新しい cron イベントを作成するには?
-
定期的に実行される cron イベント機能を取得するには、2つのステップがあります。 最初のステップは、WordPressにフックについて伝えることです。 これは、WP Crontrol が提供するために作成された部分です。 2番目のステップは、フックが実行されたときに関数を呼び出すことです。
ステップ1: フックを追加する
ツール → Cron イベント の管理画面で、「新規追加」をクリックし、フックの詳細を入力します。通常の PHP 変数の命名規則に準拠したフック名にするのが最良です。イベントスケジュールは、フックが実行される頻度です。適切な間隔が表示されない場合は、設定 → Cron スケジュールの管理画面で間隔を追加してください。
ステップ2: 関数の記述
この部分はPHPコードで (例えば、テーマの
functions.php
ファイルで) 実行されます。フックを実行するために、WordPress はアクションを実行します。このために、このアクションが実行されたときに実行する関数を WordPress に伝える必要があります。次の行はこれを実現します:add_action( 'my_hookname', 'my_function' );
次のステップは、関数を書くことです。 ここに簡単な例があります:
function my_function() { wp_mail( 'hello@example.com', 'WP Crontrol', 'WP Crontrol rocks!' ); }
-
新しい PHP cron イベントを作成するにはどうすればよいですか ?
-
ツール → Cron イベントの管理画面で、「新規追加」をクリックします。
表示されたフォームで「PHP Cron Event」を選択し、スケジュールと次回の実行時間を入力します。イベントのスケジュールは、イベントが実行される頻度です。良い間隔が見当たらない場合は、管理画面の「設定」→「Cron スケジュール」で追加してください。「フックコード」領域には、cron イベントが実行されたときに実行されるべき PHP コードを入力します。PHPの開始タグ(<?php
)は必要ありません。WP Crontrol wiki で、PHP Cron イベントの機能とセキュリティに関するすべてを読むことができます。
-
どのユーザーが PHP cron イベントとスケジュールを管理できますか ?
-
manage_options
権限を持つユーザーだけが cron イベントとスケジュールを管理できます。デフォルトでは、管理者のみがこの機能を備えています。 -
PHP の cron イベントを管理できるユーザーは?これは危険なのでしょうか?
-
edit_files
権限を持つユーザーのみが PHP の cron イベントを管理することができます。これは、ユーザーが WordPress 管理エリアを介してファイルを編集できない場合(プラグインエディタやテーマエディタなど)、WP Crontrol 内で PHP の cron イベントを追加、編集、削除できないことを意味します。デフォルトでは、管理者のみがこの機能を持ち、マルチサイトを有効にすると特権管理者のみがこの権限を持つようになります。DISALLOW_FILE_MODS
やDISALLOW_FILE_EDIT
の設定定数でファイル編集が無効になっている場合、どのユーザーもedit_files
の権限を持つことができません。すなわち PHP cron イベントの追加、編集、削除が許可されません。そのため、WP Crontrol を有効にしても、任意の PHP コードを実行するのに必要なユーザーのアクセスレベルは変わりません。
WP Crontrol wiki で、PHP Cron イベントの機能とセキュリティに関するすべてを読むことができます。
-
WP-CLI コマンドは利用できますか ?
-
以前に WP Crontrol に含まれていた Cron コマンドは、WP-CLI 自体の一部になりました。 詳細については、
wp help cron
を参照してください。 -
WP Crontrol プラグインを無効化するとどうなりますか?
-
プラグインのヘッダー画像の写真は誰が撮ったものですか?
-
この写真は、Michael Pardoが撮影したもので、パブリックドメインです。
評価
貢献者と開発者
変更履歴
1.16.1
- Confirm support for WordPress 6.4
1.16.0
- Allow persistent WordPress core hooks to be cleared if there’s more than one event with that hook
- Add the number of matching events to the hook deletion link text
- Scrap the Ajax request that checks if the current page of cron events has changed since loading
- Make some improvements to sorting the cron event list table columns
- Increase the minimum supported PHP version to 7.4
1.15.3
- Pass the
$doing_wp_cron
value to thecron_request
filter so it matches WordPress core - Miscellaneous code quality improvements
1.15.2
- Improves the terminology around pausing and deleting hooks and events
- Improves accessibility of the event listing table for keyboard users
- Removes an unnecessary SQL query when fetching the list of paused events
- Adds an FAQ about deactivating the plugin
1.15.1
- Confirms the plugin is compatible with PHP 8.2
- Increases compatibility with other plugins that include very old Composer autoloader implementations
1.15.0
- Introduces the ability to pause and resume cron events from the event listing screen; see the FAQ for full details
- Adds the site time to the cron event editing screen
- Implements an autoloader to reduce memory usage
- Bumps the minimum supported version of PHP to 5.6
1.14.0
- Reverts the changes introduced in version 1.13 while I look into the problem with the deployment process for wordpress.org
1.13.2
- Fixes another issue with missing files in the release
1.13.1
- Fixes an issue with missing files in the 1.13.0 release
1.13.0
- Introduces the ability to pause and resume cron events from the event listing screen; see the FAQ for full details
- Implements an autoloader to reduce memory usage
- Bumps the minimum supported version of PHP to 5.6
1.12.1
- Corrects an issue where an invalid hook callback isn’t always identified
- Various code quality improvements
1.12.0
- Fix the PHP cron event management.
- More “namespacing” of query variables to avoid conflicts with other cron management plugins.
1.11.0
- Introduced an
Export
feature to the event listing screen for exporting the list of events as a CSV file. - Added the timezone offset to the date displayed for events that are due to run after the next DST change, for extra clarity.
- Introduced the
crontrol/filter-types
andcrontrol/filtered-events
filters for adjusting the available event filters on the event listing screen. - Lots of code quality improvements (thanks, PHPStan!).
1.10.0
- Support for more granular cron-related error messages in WordPress 5.7
- Several accessibility improvements
- Warning for events that are attached to a schedule that is too frequent
- More clarity around events and schedules that are built in to WordPress core
- Add a Help tab with links to the wiki and FAQs
1.9.1
- Fix the adding of new cron events when
DISALLOW_FILE_EDIT
is true.
1.9.0
- Add filters and sorting to the event listing screen. Props @yuriipavlov.
- Replace the “Add New” tabs with a more standard “Add New” button on the cron event listing page.
- Switch back to using browser-native controls for the date and time inputs.
- Add an error message when trying to edit a non-existent event.
- Introduce an informational message which appears when there are events that have missed their schedule.
- Fire actions when cron events and schedules are added, updated, and deleted.
1.8.5
- Fix an issue with the tabs in 1.8.4.
1.8.4
- Add a warning message if the default timezone has been changed. More information.
- Fixed string being passed to
strtotime()
function when theNow
option is chosen when adding or editing an event.
1.8.3
- Fix the editing of events that aren’t currently listed on the first page of results.
1.8.2
- Bypass the duplicate event check when manually running an event. This allows an event to manually run even if it’s due within ten minutes or if it’s overdue.
- Force only one event to fire when manually running a cron event.
- Introduce polling of the events list in order to show a warning when the event listing screen is out of date.
- Add a warning for cron schedules which are shorter than
WP_CRON_LOCK_TIMEOUT
. - Add the Site Health check event to the list of persistent core hooks.
1.8.1
- Fix the bottom bulk action menu on the event listing screen.
- Make the timezone more prominent when adding or editing a cron event.
1.8.0
- Searching and pagination for cron events
- Ability to delete all cron events with a given hook
- More accurate response messages when managing events (in WordPress 5.1+)
- Visual warnings for events without actions, and PHP events with syntax errors
- Timezone-related clarifications and fixes
- A more unified UI
- Modernised codebase
1.7.1
- Correct the PHP.net URL for the
strtotime()
reference.
1.7.0
- Remove the
date
andtime
inputs and replace with a couple of preset options and a plain text field. Fixes #24 . - Ensure the schedule name is always correct when multiple schedules exist with the same interval. Add error handling. Fixes #25.
- Re-introduce the display of the current site time.
- Use a more appropriate HTTP response code for unauthorised request errors.
1.6.2
- Remove the ability to delete a PHP cron event if the user cannot edit files.
- Remove the
Edit
link for PHP cron events when the user cannot edit the event. - Avoid a PHP notice due to an undefined variable when adding a new cron event.
1.6.1
- Fix a potential fatal error on the cron events listing screen.
1.6
- Introduce bulk deletion of cron events. Yay!
- Show the schedule name instead of the schedule interval next to each event.
- Add core’s new
delete_expired_transients
event to the list of core events. - Don’t allow custom cron schedules to be deleted if they’re in use.
- Add links between the Events and Schedules admin screens.
- Add syntax highlighting to the PHP code editor for a PHP cron event.
- Styling fixes for events with many arguments or long arguments.
- Improvements to help text.
- Remove usage of
create_function()
. - Fix some translator comments, improve i18n, improve coding standards.
1.5.0
- Show the hooked actions for each cron event.
- Don’t show the
Delete
link for core’s built-in cron events, as they get re-populated immediately. - Correct the success message after adding or editing PHP cron events.
- Correct the translations directory name.