前言介紹
- 這款 WordPress 外掛「Transient Cleaner」是 2012-11-27 上架。
- 目前有 1000 個安裝啟用數。
- 上一次更新是 2025-04-12,距離現在已有 22 天。
- 外掛最低要求 WordPress 4.4 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
- 有 23 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
dartiss |
外掛標籤
cache | clean | options | database | transient |
內容簡介
從你的 WordPress options 資料庫表格中清理已過期的 transients。這個外掛是原創且最好用的!
“Transients (翻譯中:暫存資料) 是 WordPress 中儲存快取資料的一個簡單且標準化的方式,它會以自定名稱和時間框架來暫時儲存在 WordPress 資料庫中,之後會到期並被刪除。”
不幸地,若你沒有嘗試訪問這個 transient,它就只有在那時才會被刪除。即使它已經過期了,WordPress 也不會自動去移除它。這是一個已知的問題,但根據 FAQ 所說的原因,這個問題沒有被充分解決。
為什麼這是個問題呢?因為許多外掛都會用 transients 來“快取”資料(我的外掛也包含在內)。因此,這意味著過期的資料可能會殘留下來並積累,進而導致資料庫的表格過於臃腫。
與此同時,這個外掛就是你一直以來渴望的英雄。只需啟用這個外掛,然後享受一個更加整潔且較小的 options 表格。它還增加了額外建議,當一次資料庫升級後,所有的 transients 會被清除。
我要感謝 WordPress 開發人員 Andrew Nacin 對此早期的討論。同時,我還要感謝Everybody Staze 的一篇有用文章,該文確保了所提出的解決方案是有意義的,以及W-Shadow.com的清理程式碼。
圖示是由非常有才華的Janki Rathod設計的 ♥️
👉 請造訪Github 頁面以了解最新的代碼開發、計畫中的增強功能及已知問題 👈
設定畫面
在 管理 -> 工具 -> Transients 中,有個選項頁面可以讓你調整何時清理,包括執行一次即時清理和設定自動排程的時間。
你還可以要求對 options 資料庫表格進行最佳化,以提升系統效能!
運行 Lite 模式
有一種“Lite”模式可供選擇。啟用這個模式後,選項畫面就不會再出現,且會使用預設設定。好處是,Admin 區塊可以提供更好的效能,尤其是在多站點環境下更顯著,因為沒有人能夠“亂搞”設定。
要啟用此功能,請使用以下指令碼...
define( 'TC_LITE', true );
這個要加入到你的 wp-config.php 檔案中。
使用個別鉤子
如果你是那種喜歡為 WordPress 編寫程式的人(真的嗎?),那麼我已經加入了一些鉤子,讓你可以呼叫我們相當精簡的清理功能...
housekeep_transients - 它會清除掉所有過期的 transients
clear_all_transients - 它會移除所有的transients,包括未過期的
原文外掛簡介
Clean expired transients from your options table. The original and best!
Transient housekeeping was added to the core of WordPress after version 5.8. However, I have decided to open up this plugin to all versions to allow for manual transient cleaning. Longer term I am working on a new version of the plugin, designed specifically for all WordPress releases.
Tested up to PHP 8.2
Fully complies with WordPress coding standards
Compliant with the stronger WordPress VIP coding standards, as well as compatibility with their platform
Community plugin – visit the [Github page](https://github.com/dartiss/[repo link] “Github”) to get involved with the latest code development, request enhancements and report issues
“Transients are a simple and standardized way of storing cached data in the WordPress database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted.”
Unfortunately, expired transients only get deleted when you attempt to access them. If you don’t access the transient then, even though it’s expired, WordPress will not remove it. This is a known “issue” but due to reasons, which are explained in the FAQ, this has not been adequately resolved.
Why is this a problem? Transients are often used by plugins to “cache” data (my own plugins included). Because of this it means that expired data can be left and build up, resulting in a bloated database table.
Meantime, this plugin is the hero that you’ve been waiting for. Simply activate the plugin, sit back and enjoy a much cleaner, smaller options table. It also adds the additional recommendation that after a database upgrade all transients will be cleared down.
The Settings Screen
Within Administration -> Tools -> Transients an options screen exists allowing you to tweak when you’d like cleaning to happen, including the ability to perform an ad-hoc run, and when you’d like the to be automatically scheduled.
You can even request an optimization of the options table to give your system a real “pep”!
Running in Lite mode
A “lite” mode is available. By activating this the options screen will no longer appear and default settings will be used. The advantage? Improved performance to Admin and, especially if you’re running multi-site, no chance of anybody “tinkering” with the settings.
To activate, use the following…
define( 'TC_LITE', true );
This should be added to your wp-config.php file.
Using hooks
If you’re the type of odd person who likes to code for WordPress (really?) then I’ve added a couple of hooks so you can call our rather neat cleaning functions…
housekeep_transients – this will clear down any expired transients
clear_all_transients – this will remove any and all transients, expired or otherwise
Acknowledgements
I’d like to thank WordPress Developer Andrew Nacin for his early discussion on this. Also, I’d like to acknowledge the useful article at Everybody Staze for ensuring the proposed solution made sense, and W-Shadow.com for the cleaning code.
Iconography is courtesy of the very talented Janki Rathod.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Transient Cleaner」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0 | 1.1 | 1.6 | 1.7 | 1.2.4 | 1.3.1 | 1.4.2 | 1.5.7 | 1.5.8 | 1.6.1 | 1.6.2 | trunk |
延伸相關外掛(你可能也想知道)
WP Super Cache 》本外掛可以從您的動態 WordPress 部落格生成靜態 HTML 檔案。在產生 HTML 檔案後,您的網頁伺服器會傳送該檔案,而不是處理比較沉重、耗費更多資源的 WordPre...。
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 》WP-Optimize Cache 是一個革命性的、全方位的 WordPress 效能外掛,將您的網站做快取、清理資料庫及圖片壓縮,讓您的網站快速且最佳化。我們的快取功能是建構...。
WP Fastest Cache 》han PNG or JPEG, which means faster downloads and less data consumption for your visitors, Database Cleanup – Detect and delete unnecessary d...。
SpeedyCache – Cache, Optimization, Performance 》SpeedyCache 是一款 WordPress 外掛,能透過網頁快取、最小化檔案和檔案壓縮的方式,幫助您減少網站載入時間。, 您可以在 https://speedycache.com/docs 找到...。
Breeze – WordPress Cache Plugin 》Breeze是由Cloudways團隊開發的一款免費、簡單(卻功能強大)且使用者友好的WordPress快取外掛。它提供不同層級的WordPress效能優化選項,在WordPress、搭配W...。
Jetpack Boost – Website Speed, Performance and Critical CSS 》使用 Jetpack Boost 優化網頁性能加速你的 WordPress 網站。輕鬆啟用一鍵優化,提升核心 Web 重要指標。, 你是否知道,更快的網站可以:, , 在 Google 搜尋排...。
OMGF | GDPR/DSGVO Compliant, Faster Google Fonts. Easy. 》, 使用 Google 的字型服務,怎麼可能與 GDPR 不符呢?事實上,當使用者的瀏覽器要求字型時,他們的 IP 會被 Google 記錄並用於分析。, — Lifehacker, , OMG...。
10Web Booster – Website speed optimization, Cache & Page Speed optimizer 》10Web Booster 是提升網站整體效能的速度優化外掛程式,讓您專注並蓬勃發展 WordPress 網站的創意方面,同時讓我們專心於 WordPress 效能最佳化。透過 10Web ...。
NitroPack – Caching & Speed Optimization for Core Web Vitals, Defer CSS & JS, Lazy load Images and CDN 》NitroPack 是一個全方位的網站效能優化服務外掛,它包含了所有使網站加速所需的功能,包括圖片優化、代碼壓縮、快取、CDN (內容交付網路)、延遲載入等等。, ,...。
Hummingbird Performance – Cache & Page Speed Optimization for Core Web Vitals | Critical CSS | Minify CSS | Defer CSS Javascript | CDN 》Hummingbird 透過添加細調控制文件壓縮、延後 CSS 和 JavaScript 樣式和腳本、CSS 和 JS 壓縮,以及懶加載等全球最佳緩存優化方法,讓您的網站更快,並優化網...。
Cache Enabler 》Cache Enabler 是個簡單卻強大的 WordPress 快取外掛,使用起來簡單且只需要最小化的設定,最重要的是能夠幫助網站提升效能來達到更快的載入時間。它會將前端...。
Aruba HiSpeed Cache 》Aruba HiSpeed Cache 是一個外掛,直接與 HiSpeed Cache 服務介面互動,該服務適用於 Aruba 主機平台,並能在 WordPress 儀表板中自動管理,無需訪問網站控制...。
Recent Tweets Widget 》查看最新的 WordPress 外掛優惠。, 使用快取的 Twitter API v1.1 最新的 Recent Tweets Widget (最近的 Tweet 外掛)。它使用新版 Twitter API v1.1,並將 Twe...。
Clearfy Cache – WordPress optimization plugin, Minify HTML, CSS & JS, Defer 》數千個使用者已經使用 Clearfy 外掛優化他們的 WordPress 網站。這是一個綜合且免費的工具,擁有豐富的設定。搭配其他外掛使用,可以讓您的 WordPress 網站更...。
Seraphinite Accelerator 》這個外掛可以加速您的網站,使其更具吸引力和搜索引擎友好性。詳細了解如何使用。, 若要使用免費的額外功能,請按照屏幕上的外掛程式指示安裝免費的延伸外掛...。