
前言介紹
- 這款 WordPress 外掛「Instant Back/Forward」是 2025-07-19 上架。
- 目前有 10000 個安裝啟用數。
- 上一次更新是 2025-11-30,距離現在已有 88 天。
- 外掛最低要求 WordPress 6.8 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.2 以上。
- 有 1 人給過評分。
- 論壇上目前有 1 個提問,問題解答率 100% ,不低,算是個很有心解決問題的開發者團隊了!
外掛協作開發者
westonruter | performanceteam | wordpressdotorg |
外掛標籤
caching | performance |
內容簡介
總結: 這個外掛程式通過從 Cache-Control 回應標頭中刪除 no-store 指令,以實現瀏覽器的即時返回/前進功能。它允許之前訪問過的頁面在記憶體中保存,無需再次從服務器加載,提高了 WordPress 頁面導航的速度。
問題:
1. 什麼時候 WordPress 會發送 no-cache 標頭?
2. 啟用外掛後,為了看到效果,應該採取什麼步驟?
3. 這個外掛程式主要解決了什麼問題?
4. 這個外掛程式調整了哪些網頁回應標頭?
5. no-store 指令的添加初衷是什麼?
原文外掛簡介
This plugin was formerly called as “No-cache BFCache”, which admittedly was a poor jargony name and was too narrowly scoped.
This plugin enables instant back/forward navigation via the browser’s bfcache. It does this by removing the no-store directive from the Cache-Control response header, which WordPress sends by default when nocache_headers() is called. This happens primarily when a user is logged in, but some plugins may send these “no-cache” headers such as on the Cart or Checkout pages for an e-commerce site. Upon activation, to see the effect, you must log out of WordPress and log back in again, ensuring “Remember Me” is checked. Even so, another plugin, theme or server configuration may be active which makes pages ineligible for bfcache due to other blocking reasons. Nevertheless, the removal of no-store will still speed up back/forward navigations since pages may then be served from the browser’s HTTP cache, eliminating the need to re-download the HTML from the server. This is a feature plugin to implement #63636 in WordPress core.
Blog post: Instant Back/Forward Navigations in WordPress
The speed of page navigations in WordPress saw a big boost in 6.8 with the introduction of Speculative Loading. However, by default Speculative Loading in WordPress is not configured to enable instant page loads, which requires a non-conservative eagerness with the prerender mode; not all sites can even opt in to prerendering due to compatibility issues, such as with analytics, and due to concerns about sustainability with unused prerenders (e.g. increasing server load and taxing a user’s bandwidth/CPU). While Speculative Loading (i.e. the Speculation Rules API) is relatively new and currently only supported in Chromium browsers (e.g. Chrome and Edge), there is a much older web platform technology that enables prerendering and which is supported in all browsers: the back/forward cache (bfcache). This instant loading involves no network traffic and no CPU load, since previously visited pages are stored in memory. According to the web.dev article on back/forward cache:
Chrome usage data shows that 1 in 10 navigations on desktop and 1 in 5 on mobile are either back or forward. With bfcache enabled, browsers could eliminate the data transfer and time spent loading for billions of web pages every single day!
Also learn more via the following video:
Normally, WordPress sends a Cache-Control header with the no-store directive when a user is logged in. This has the effect of breaking the browser’s bfcache, which means that navigating back or forward in the browser requires the pages to be re-fetched from the server and for any JavaScript on the page to re-execute. The result can be a sluggish navigation experience not only when navigating around the WP Admin (see Jetpack demo video and demo video below) but also when navigating around the frontend of a site. Furthermore, the lack of bfcache can cause data loss when data has been entered via a JavaScript-built UI since this state is lost when a page is not restored via bfcache (see WooCommerce demo video and demo video below).
The reason why the no-store directive was added in the first place was due to a privacy concern where an authenticated user may log out of WordPress, only for another person to access the computer and click the back button to view the contents of the authenticated page loaded from bfcache or the HTTP cache. (See #21938.) In practice this issue depends on the user being on a shared computer who didn’t exit the browser, and it requires the malicious user to act soon before the page is evicted from bfcache (e.g. Chrome as a 10-minute timeout).
To address this privacy concern, a safeguard is in place to protect against restoring pages from bfcache and the HTTP cache after the user has logged out:
When authenticating to WordPress, a “bfcache session token” cookie is set along with the other authentication cookies. This cookie is not HTTP-only so that it can be read in JavaScript; it is a random string not used for any other purpose. When an authenticated page is served, this bfcache session token is included in the HTML as well as a script which reads the value of this cookie. When a user navigates away from the page and then navigates back to it, a script on the page checks if the current session token in the cookie matches the initial session token sent with the page. If they do not match (e.g. because the user has logged out or another user has logged in), then the contents of the page are cleared and the page is reloaded so that the contents are not available.
Since JavaScript is required to invalidate cached pages, the login form is extended to pass along whether scripting is enabled. Only when JS is enabled will the no-store directive be omitted from the Cache-Control response header. This ensures that users with JavaScript turned off will retain the privacy protection after logging out. Lastly, no-store is also only omitted if the user checked the “Remember Me” checkbox on the login form. Since it is highly unlikely a user on a shared computer would have checked this checkbox, this provides yet an additional safeguard (which may in the end prove excessive). A ✨ emoji is displayed next to the checkbox in a button that opens a popover that promotes the capability. If you want to opt out of this opt-in (and the sparkle) so that all logged-in users get bfcache, you can use the nocache_bfcache_use_remember_me_as_opt_in filter which you can use in a custom plugin or your theme:
add_filter( 'nocache_bfcache_use_remember_me_as_opt_in', '__return_false' );
When this plugin strips out the no-store directive, it also ensures that the private directive is sent in its place: “The private response directive indicates that the response can be stored only in a private cache (e.g., local caches in browsers).” WordPress is already sending private as of #57627. This directive ensures that proxies do not cache authenticated pages. In addition to ensuring private is present, this plugin also adds no-cache, max-age=0, and must-revalidate while ensuring public is removed, all to further guard against any misconfigured proxy from caching the private response.
Demo: Navigating the WordPress Admin
Without bfcache:
With bfcache:
Demo: Navigating the WordPress Frontend
Without bfcache: The drafted BuddyPress activity update is lost when navigating away from the page before submitting. The activity feed and Tweet have to be reconstructed with each back/forward navigation.
With bfcache: The drafted BuddyPress activity update is preserved when navigating away from the page without submitting. The activity feed and Tweet do not have to be reconstructed when navigating to previously visited pages via the back/forward buttons.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Instant Back/Forward」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.1.0 | 1.2.0 | 1.3.0 | 1.3.1 | trunk |
延伸相關外掛(你可能也想知道)
LiteSpeed Cache 》LiteSpeed Cache for WordPress(LSCWP)是一種全方位的網站加速外掛,包括獨家的伺服器層快取和一系列的優化功能。, LSCWP 支援 WordPress Multisite 及大多...。
WP Super Cache 》本外掛可以從您的動態 WordPress 部落格生成靜態 HTML 檔案。在產生 HTML 檔案後,您的網頁伺服器會傳送該檔案,而不是處理比較沉重、耗費更多資源的 WordPre...。
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 》WP-Optimize Cache 是一個革命性的、全方位的 WordPress 效能外掛,將您的網站做快取、清理資料庫及圖片壓縮,讓您的網站快速且最佳化。我們的快取功能是建構...。
Speed Optimizer – The All-In-One Performance-Boosting Plugin 》SiteGround Optimizer 插件是由 SiteGround 開發的,可以大幅提高任何托管環境下的 WordPress 網站性能。, 最初設計用於 SiteGround 的服務器,現在已經有近 ...。
W3 Total Cache 》W3 Total Cache (W3TC) 透過整合內容傳遞網絡 (CDN) 和最新最佳實踐等功能,提高網站性能、減少加載時間,增進 SEO、核心 Web 主要指標和整體用戶體驗。W3TC ...。
Breeze Cache 》Breeze是由Cloudways團隊開發的一款免費、簡單(卻功能強大)且使用者友好的WordPress快取外掛。它提供不同層級的WordPress效能優化選項,在WordPress、搭配W...。
Redis Object Cache 》一個由 Redis 提供支援的持久化物件快取後端。支援 Predis、PhpRedis (PECL)、Relay、複寫、哨兵、叢集化和 WP-CLI。, 若要調整連線參數、前綴的快取鍵或設定...。Cache Enabler 》Cache Enabler 是個簡單卻強大的 WordPress 快取外掛,使用起來簡單且只需要最小化的設定,最重要的是能夠幫助網站提升效能來達到更快的載入時間。它會將前端...。
Hummingbird Performance – Cache & Page Speed Optimization for Core Web Vitals | Critical CSS | Minify CSS | Defer CSS Javascript | CDN 》Hummingbird 透過添加細調控制文件壓縮、延後 CSS 和 JavaScript 樣式和腳本、CSS 和 JS 壓縮,以及懶加載等全球最佳緩存優化方法,讓您的網站更快,並優化網...。
Super Page Cache 》為何要選擇這個外掛?, 這個 Super Page Cache for Cloudflare 外掛可以讓您的網站加速,將網站快取提升至另一個層級。此外,這個外掛不僅會快取靜態文件(例...。SpinupWP 》這個外掛確保在您的網站內容更改時清除 SpinupWP 頁面快取。還沒使用 SpinupWP 嗎?請在此註冊。, SpinupWP是一個現代的伺服器控制面板,旨在協助您實施每次...。
WP Meteor Website Speed Optimization Addon 》 , WP Meteor 是一種全新的優化網頁速度的方式。即使在現有的優化基礎之上,例如:, , Autoptimize, WP Rocket, WP Total Cache, WP Super Cache, , WP Meteo...。
Server-Side Cache AutoPurge 》這個外掛能在您進行網站變更(例如更新文章)後自動清除伺服器端快取。, 自動清除功能僅適用於由SureSupport管理的使用主機控制面板中提供的「伺服器端快取」...。
Leverage Browser Caching 》這個 WordPress 外掛名稱就是『Leverage Browser Caching』,它可以解決你的 WordPress 網站中與檔案快取相關的問題,同時也可以提升網站在 Pingdom、GTmetri...。
Cachify 》Cachify 通過將帖子、頁面和自訂帖子類型作為靜態內容緩存,優化您的頁面載入。您可以選擇通過數據庫、網頁服務器的硬盤驅動器(HDD)、Memcached(僅在 Ngin...。
