
內容簡介
透過限制在您的網站低流量時段觸發 CRON 作業,您可以掌控 CRON 作業。您可以透過管理畫面進行以下操作:
指定重複 CRON 事件應該在每天何時觸發。
可選擇性地將在一天中頻繁運行的事件更新為每天運行一次。
針對特定的時間表進行操作,包括由其他外掛程式建立的自訂時間表。
排除特定的 CRON 鉤子不受影響。
益處
將重複的 CRON 事件限制只在繁忙時段之後執行有助於以下兩點:
防止 WordPress 核心、外掛程式和主題的自動更新在您的高流量時段運行,這樣使用者在最容易看見的時候不會看到維護頁面。
當自動維護在低流量時段進行時,您的伺服器上的壓力較小。
確保 CRON 事件總是執行
WordPress CRON 基於流量運作,這意味著如果您的網站流量不大,CRON 事件可能不會在其預定時間觸發。在依賴站點流量觸發的同時將您的網站 CRON 事件限制在非上班時間可能無法產生預期的結果。我建議以下兩點解決方法:
使用伺服器 CRON。WordPress 開發人員資源中建議設置系統的工作排程器以在所需的間隔執行並使用它來對 wp-cron.php 發出網路請求。 查看 WordPress 文件。
使用 Cron-Job.org。如果您無法設置系統的工作排程器,我建議將該任務外包給 Cron-Job.org,讓其自動 ping 您網站的 wp-cron.php 檔案。這是德國開發人員提供的免費服務。前往 Cron-Job.org。
外掛標籤
開發者團隊
原文外掛簡介
Take control of your CRON jobs by restricting them to your website’s low traffic hours. From the admin screen, you can:
Specify a daily window of when recurring CRON events should be triggered.
Optionally limit events that run multiple times a day to only once a day.
Optionally restrict events that run multiple times a day to only during your off-hours.
Target specific schedules, including custom ones created by other plugins.
Exclude specific CRON hooks from being affected
Benefits
Restricting your recurring CRON events to only run after hours helps with two (2) things:
Automatic updates for WordPress core, plugins, and themes are prevented from running during your highest-traffic times so users aren’t shown a maintenance page when it’s the most visible.
Less stress is placed on your server when automatic maintenance occurs during low traffic times.
Ensuring CRON Events Always Run
WordPress CRON is based on traffic, which means if your site does not see a lot of traffic, CRON events may not be triggered at the time that they are scheduled. Limiting your website’s CRON events to off-hours while also depending on site traffic to trigger them may not produce the intended results. There are two (2) solutions I recommend:
Use Server CRON. It is recommended in the WordPress developer resources to set up your system’s task scheduler to run on the desired intervals and to use that to make a web request to wp-cron.php. View WordPress Documentation.
Use Cron-Job.org. If you can’t set up your system’s task scheduler, I recommend outsourcing that job to cron-job.org to automatically ping your website’s wp-cron.php file. It is a free service from the German-based developers. Go to Cron-Job.org.
