W3 Total Cache 外掛:優化設定方法

聯盟行銷揭露 Ver 3.1
聯盟行銷揭露 Ver 3.2(僅限行動版)
測試環境 CloudwaysDebian 12Apache 2.4.69 + nginxPHP 8.2.34WordPress 7.1.3W3 Total Cache 2.10.72026-10-18 確認

WordPress 網站每多裝一個外掛,速度就難免變慢。因此,快取外掛已成為 WordPress 必備的外掛之一。 免費版有超過 100 萬次有效安裝、評分 4.4顆星的 W3 Total Cache(W3TC)外掛,是最多人使用的外掛之一。

快取設定可能讓正在使用的其他外掛部分功能失效,如果剛開始使用 WordPress,可以改用設定簡單的 Cache Enabler 或 WP Super cache。

如果需要細緻的快取設定與控制,可以使用免費版就提供強大功能的 W3 Total Cache 外掛。

Ⅰ. W3 Total Cache 安裝與 Setup Guide

  • ↳ 搜尋引擎(SEO:Search Engine Optimization)
  • ↳ 效能優化(WPO:Web Performance Optimization)
  • ↳ 整合快取:支援 CDN、頁面、Minify、物件、片段、資料庫。

搜尋 W3 Total Cache 後安裝並啟用外掛。

🧭 W3 Total Cache 安裝與 Setup Guide 模擬器
快取外掛路徑模擬器
📍Plugins›Add Plugin
安裝外掛
在搜尋欄輸入 W3 Total Cache 並點選 [Install Now],安裝完成後點選 [Activate]。
📍Performance›Setup Guide
Setup Guide
首次安裝後進入 [Dashboard] 時,會自動轉到 [Setup Guide],因為還沒有任何設定。
📍Performance›Dashboard
控制台
在引導中設定的內容會依功能顯示在 [General Settings] 方塊中,頁面快取等細部設定則在 [General Settings] 進行。
example.com/wp-admin/plugin-install.php
Add Plugins Upload Plugin
Plugins extend and expand the functionality of WordPress. You may install plugins from the WordPress Plugin Directory right on this page, or upload a plugin in .zip format by clicking the button above.
Search ResultsFeaturedPopularRecommendedFavorites
Search PluginsKeyword
922 items
W3 Total Cache
Installing...ActiveMore Details
Search Engine (SEO) & Performance Optimization (WPO) via caching. Integrated caching: CDN, Page, Minify, Object, Fragment, Database support.
By BoldGrid
★★★★★ (5,421)
Last Updated: 2 weeks ago
900,000+ Active Installations
✓ Compatible with your version of WordPress
example.com/wp-admin/admin.php?page=w3tc_setup_guide
DashboardSettingsToolsInfoSupportUpgrade
W3 Total CacheSetup Guide
TOTAL CACHE: Setup Guide
  • Welcome
  • Page Cache
  • Database Cache
  • Object Cache
  • Image Converter
  • Lazy Load
  • More Caching Options
Welcome to the W3 Total Cache Setup Guide!
By allowing us to collect data about how W3 Total Cache is used, we can improve our features and experience for everyone. This data will not include any personally identifiable information. Feel free to review our terms of use and privacy policy.
AcceptDecline
SKIPNEXT
example.com/wp-admin/admin.php?page=w3tc_dashboard
DashboardSettingsToolsInfoSupportUpgrade
W3 Total CacheDashboard
Flush caches with Empty All Caches
Account
License: Free
Status: Free license, no expiration
Upgrade to W3 Total Cache Pro now to unlock additional settings and features that can further improve your site’s performance and Google PageSpeed ratings.
Learn more about Pro
General Settings
Preview Modedisabled
Page Cachedisabled
Minifydisabled
Opcode Cacheenabled
Database Cachedisabled
Object Cachedisabled
Browser Cachedisabled
CDNdisabled
Reverse Proxydisabled
Statisticsdisabled
Fragment Cachedisabled
Debugdisabled
Settings can be modified by visiting General Settings
Image Optimization Summary
Enable Image Converter
PageSpeed Report
Before you can get started using the Google PageSpeed tool, you’ll first need to authorize access. Please click here.
點選左側選單中亮起的項目或畫面上的按鈕。

首次安裝後進入 [Dashboard] 頁面時,會自動轉到 [Setup Guide],因為還沒有任何設定。

在 Setup Guide 中可以設定 ① 頁面快取、② 資料庫快取、③ 物件快取、④ 瀏覽器快取、⑤ 圖片優化、⑥ 延遲載入、⑦ 其他快取選項。

W3 Total Cache Setup Guide ① 頁面快取_磁碟快取(選擇 Enhanced)

頁面快取設定方面,W3TC 預設推薦的是 Disk: [Enhanced]。從表格可以看到,Disk: Enhanced 比 Disk: Basic 快約 10.3ms,以 TTFB 來看效能約提升 17.8%。

W3 Total Cache Setup Guide ② 資料庫快取_選擇磁碟快取

資料庫快取選擇磁碟快取。

W3 Total Cache Setup Guide ③ 物件快取_選擇 Redis
W3 Total Cache Setup Guide ④ 瀏覽器快取
W3 Total Cache Setup Guide ⑤ 圖片優化-使用 WebP 轉換器
W3 Total Cache Setup Guide ⑥ 延遲載入-圖片延遲載入
W3 Total Cache Setup Guide ⑦ 其他快取選項設定_進入控制台後設定

在引導中設定的內容已反映在控制台上。

點選右上角的 [Settings] 分頁,就能從 [General Settings] 開始設定頁面快取等項目。

W3TC 控制台-設定__

ⓐ 左側管理選單的 [各頁面設定] 與 ⓑ 右上角的 [Settings] 分頁 都會前往頁面快取、 Minify 等 進階設定;從 General Settings 分頁上方中央進入各個頁面,就能看到頁面快取與 Minify 從一般設定到 進階設定的所有內容。

Ⅱ. W3 Total Cache 快取設定

  • ↳ 快取功能

這是 W3TC 設定中的 General Settings 分頁。

🧭 W3 Total Cache 快取設定模擬器
路徑模擬器
📍Performance›General Settings›General
預覽模式
在實際部署快取變更之前,可以啟用 [Preview mode] 預先測試是否有錯誤。
📍Performance›General Settings›Page Cache›Advanced Settings
頁面快取
勾選 [Page Cache] 的 [Enable],確認方式為 [Disk: Enhanced] 後點選 [Save Settings]。細部項目在 [Advanced Settings] 設定。
📍Performance›General Settings›Minify›Advanced Settings
Minify
勾選 [Minify] 的 [Enable] 並點選 [Save Settings],再到 [Advanced Settings] 設定 HTML、CSS、JS 的 Minify 項目。
📍Performance›General Settings›Opcode Cache
opcode 快取
opcode 快取會自動套用伺服器上已安裝的 opcode;若未安裝,則設為停用。
📍Performance›General Settings›Database Cache›Object Cache
資料庫·物件快取
分別勾選 [Database Cache] 與 [Object Cache] 的 [Enable] 並儲存。細部項目在 [Database Cache] 與 [Object Cache] 畫面設定。
📍Performance›General Settings›Browser Cache›Advanced Settings
瀏覽器快取
勾選 [Browser Cache] 的 [Enable] 並儲存後,再到 [Advanced Settings] 依檔案類型設定快取項目。
example.com/wp-admin/admin.php?page=w3tc_general
DashboardSettingsToolsInfoSupportUpgrade
|||||||||||||||||
Empty All Caches
General
Preview mode:
Enable
Use preview mode to test configuration scenarios prior to releasing them (deploy) on the actual site. Preview mode remains active even after deploying settings until the feature is disabled.
Page Cache
Page cache is a technique used to speed up the performance of a website by storing a copy of the generated HTML page in the server’s memory or disk, and then serving that copy to subsequent visitors instead of generating the page from scratch each time. This can result in significant speed improvements for websites with high traffic or dynamic content.
Basic SettingsPremium ServicesHelp
Page Cache:
Caching pages will reduce the response time of your site and increase the scale of your web server.
Page Cache Method:
Minify
Minification is a technique used to reduce the file size of HTML, CSS, and JavaScript files by removing unnecessary characters such as whitespace, comments, and line breaks. This process can significantly improve the load times of web pages by reducing the amount of data that needs to be downloaded by the user’s browser.
Basic SettingsPremium ServicesHelp
Minify:
Minification can decrease file size of HTML, CSS, JS and feeds respectively by ~10% on average. Learn more
Minify mode:
Auto
Manual
Select manual mode to use fields on the Minify settings tab to specify files to be minified, otherwise files will be minified automatically. Learn more
Minify Cache Method:
Learn more
HTML minifier:
Learn more
JS minifier:
CSS minifier:
Opcode Cache
Opcode cache is a powerful feature that enhances the performance of a WordPress website by caching compiled PHP code. By storing pre-compiled code in memory, opcode cache eliminates the need for repetitive interpretation and compilation of PHP files, resulting in significantly faster execution times. Opcode cache reduces server load and improves response times, ultimately enhancing the overall speed and responsiveness of your WordPress site. If opcode cache is available on the hosting server it will automatically be selected in the dropdown and enabled.
Opcode Cache
Validate timestamps:
Enable
Once enabled, each file request will update the cache with the latest version. When this setting is off, the Opcode Cache will not check, instead PHP must be restarted in order for setting changes to be reflected.
Database Cache
Enable this setting to utilize the power of caching your WordPress site’s database queries. By storing frequently accessed database queries in memory, the database cache reduces the need for repetitive database interactions, resulting in faster page load times. This feature is particularly beneficial for websites with heavy database usage, improving overall performance and delivering a smoother user experience.
Basic SettingsPremium ServicesHelp
Database Cache:
Caching database objects decreases the response time of your site. Best used if object caching is not possible.
Database Cache Method:
Object Cache
Enable this option to utilize an object cache mechanism, which significantly enhances the performance of your WordPress website. Object caching stores frequently accessed database queries and complex data structures in memory, reducing the need to retrieve them from the database repeatedly. By doing so, it minimizes the processing time required to generate dynamic content, resulting in faster page loading times and improved overall site speed. Enabling object cache is particularly beneficial for websites with heavy database usage or high traffic volumes, as it helps alleviate the strain on the server by efficiently serving cached data.
Basic SettingsPremium ServicesHelp
Object Cache:
Object caching greatly increases performance for highly dynamic sites that use the Object Cache API.
Object Cache Method:
Browser Cache
Enabling browser caching will instruct visitors’ web browsers to store static files from your WordPress website, such as images, CSS, and JavaScript files, locally on their devices. By doing so, subsequent visits to your site will retrieve these cached files from the browser’s storage, reducing the need for repeated downloads. This results in faster page loading times and a smoother browsing experience for your visitors, ultimately improving the overall speed and performance of your WordPress website.
Basic SettingsPremium ServicesHelp
Browser Cache:
Enable HTTP compression and add headers to reduce server load and decrease file load time.
example.com/wp-admin/admin.php?page=w3tc_pgcache
DashboardSettingsToolsInfoSupportUpgrade
|||||||
Empty All Caches
Always Cached extension is currently disabled. To enable the extension click here.
General
Cache front page
For many blogs this is your most visited page, it is recommended that you cache it. Learn more
Cache feeds: site, categories, tags, comments
Even if using a feed proxy service enabling this option is still recommended. Learn more
Handle XML mime type
Return correct Content-Type header for XML files (e.g., feeds and sitemaps). Learn more
Cache SSL (HTTPS>) requests
Cache SSL requests (uniquely) for improved performance. Learn more
Cache URI with query string variables
Search result (and similar) pages will be cached if enabled. Learn more
Cache 404 (not found) pages
Reduce server load by caching 404 pages. If the disk enhanced method of disk caching is used, 404 pages will be returned with a 200 response code. Use at your own risk. Learn more
Don’t cache pages for logged in users
Unauthenticated users may view a cached version of the last authenticated user’s view of a given page. Disabling this option is not recommended. Learn more
Don’t cache pages for following user roles
Select user roles that should not receive cached pages: Learn more
Administrator
Editor
Author
Contributor
Subscriber
Aliases
Cache alias hostnames:
Enable
If the same WordPress content is accessed from different domains. Learn more
Additional home URLs:
Specify full home URLs of your mirrors so that plugin will flush it’s cache when content is changed. For example: http://my-site.comhttp://www.my-site.comhttps://my-site.com Learn more
Cache Preload
Automatically prime the page cache
Automatically primes the page cache using the settings configured below. Learn more
Update interval:
900seconds
The number of seconds to wait before creating another set of cached pages. Learn more
Pages per interval:
10
Limit the number of pages to create per batch. Fewer pages may be better for under-powered servers. Learn more
Sitemap URL:
 
A compliant sitemap can be used to specify the pages to maintain in the primed cache. Pages will be cached according to the priorities specified in the XML file. Learn more
Preload the sitemap once
Stop cache preloading after every URL in the sitemap has been processed. Disable and re-enable cache preloading to start a new pass.
Preload cache upon publishing a post
Only applies to pages, posts, and custom post types whose status transitioned from a non-published status to the “published” status. Learn more
Preload cache upon updating a post
Applies after updating any page, post, or custom post type with the final status being “published”. Learn more
Purge Policy:
Specify the pages and feeds to purge when posts are created, edited, or comments posted. The defaults are recommended because additional options may reduce server performance: Learn more
Front page
Post page
Blog feed
Post comments pages
Post author pages
Post terms pages
Post comments feed
Post author feed
Post terms feeds
Daily archive pages
Monthly archive pages
Yearly archive pages
rdf
rss
rss2 (default)
atom
Choose which feed types should be automatically purged. Learn more
Purge limit:
10
Specify number of pages that lists posts (archive etc.) that should be purged on post updates etc., i.e. example.com/ ... example.com/page/5.
0 means all pages that lists posts are purged, i.e. example.com/page/2 ... Learn more
Additional pages:
Specify additional pages to purge. Including parent page in path. Ex: parent/posts. Learn more
Purge sitemaps:
([a-z0-9_\-]*?)sitemap([a-z0-9_\-]*)?\.(?:xml|xsl)
Specify a regular expression that matches your sitemaps. Learn more
REST API
Use these controls to determine how the WordPress REST API responds to visitors and integrations. Caching API responses can dramatically reduce load when headless frontends, mobile apps, or third-party services request the same data repeatedly, but you can keep responses uncached for highly dynamic endpoints or disable the API altogether when it is not needed to reduce attack surface. Learn more
REST API
Don’t cache
Cache★ PRO
Disable REST API
If you’re using the WordPress API make sure to use caching to scale performance. Show More ▾
Advanced
Late initialization:
Enable
Enables support for WordPress functionality in fragment caching for the page caching engine. Use of this feature may increase response times. Learn more
Late caching:
Enable
Overwrites key of page caching via custom filters by postponing entry extraction during the init action. Learn more
Compatibility mode:
Enable
Decreases performance by ~20% at scale in exchange for increasing interoperability with more hosting environments and WordPress idiosyncrasies. Enable this option if you experience issues with the Apache rules. Learn more
Reject HEAD requests:
Disable caching of HEAD HTTP requests
If disabled, HEAD requests can often be cached resulting in “empty pages” being returned for subsequent requests for a URL. Learn more
Maximum lifetime of cache objects:
3600seconds
Determines the natural expiration time of cache items. The higher the value, the larger the cache.
Max lifetime is limited by the W3TC_CACHE_FILE_EXPIRE_MAX constant (2592000 seconds) which can be overridden in wp-config.php.
Garbage collection interval:
3600seconds
If caching to disk, specify how frequently expired cache data is removed. For busy sites, a lower value is best. Learn more
Comment cookie lifetime:
1800seconds
Significantly reduce the default TTL for comment cookies to reduce the number of authenticated user traffic. Enter -1 to revert to default TTL. Learn more
Accepted query strings:
ScCid
_branch_match_id
_bta_c
_bta_tid
_ga
_gl
_ke
adgroupid
adid
age-verified
ao_noptimize
campaignid
campid
click_id
cn-reloaded
customid
dicbo
dm_i
ef_id
epik
fb_action_ids
fb_action_types
fb_source
fbclid
gclid
gclsrc
gdffi
gdfms
gdftrk
hsa_acc
hsa_ad
hsa_cam
hsa_grp
hsa_kw
hsa_mt
hsa_net
hsa_src
hsa_tgt
hsa_ver
igshid
li_fat_id
matomo_campaign
matomo_cid
matomo_content
matomo_group
matomo_keyword
matomo_medium
matomo_placement
matomo_source
mc_cid
mc_eid
mkcid
mkevt
mkrid
mkwid
msclkid
mtm_campaign
mtm_cid
mtm_content
mtm_group
mtm_keyword
mtm_medium
mtm_placement
mtm_source
pcrid
piwik_campaign
piwik_keyword
piwik_kwd
pk_campaign
pk_cid
pk_content
pk_keyword
pk_kwd
pk_medium
pk_source
pp
redirect_log_mongo_id
redirect_mongo_id
ref
s_kwcid
sb_referer_host
si
sscid
tblci
toolid
trk_contact
trk_module
trk_msg
trk_sid
ttclid
twclid
usqp
utm_campaign
utm_content
utm_expid
utm_id
utm_medium
utm_source
utm_term
wbraid
Always cache URLs that use these query string name-value pairs. The value part is not required. But if used, separate name-value pairs with an equals sign (i.e., name=value). Each pair should be on their own line. Learn more
Rejected user agents:
Never send cache pages for these user agents. Learn more
Rejected cookies:
wptouch_switch_toggle
Never cache pages that use the specified cookies. Learn more
Never cache the following pages:
wp-.*\.php
index\.php
Always ignore the specified pages / directories. Supports regular expressions. Learn more
Never cache pages associated with these categories:
Always ignore all pages filed under the specified category slugs. Learn more
Never cache pages that use these tags:
Always ignore all pages filed under the specified tag slugs. Learn more
Never cache pages by these authors:
Always ignore all pages filed under the specified author usernames. Learn more
Never cache pages that use these custom fields:
Always ignore all pages filed under the specified custom fields. Separate name-value pairs with an equals sign (i.e., name=value). Learn more
Cache exception list:
wp-comments-popup.php
wp-links-opml.php
wp-locations.php
Cache the specified pages / directories even if listed in the “never cache the following pages” field. Supports regular expression. Learn more
Non-trailing slash pages:
sitemap(_index)?\.xml(\.gz)?
([a-z0-9_\-]+)?sitemap\.xsl
[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?
Cache the specified pages even if they don’t have trailing slash. Learn more
Specify page headers:
Last-Modified
Content-Type
X-Pingback
P3P
Link
Specify additional page headers to cache. Learn more
Purge via WP Cron
Enabling this will schedule a WP-Cron event that will flush the Page Cache. If you prefer to use a system cron job instead of WP-Cron, you can schedule the following command to run at your desired interval: “wp w3tc flush posts”. If the Always Cached extension is active and enabled, page cache entries will instead be added to the queue instead of being purged from the cache. Learn more
Page Cache is disabled! Enable it here to enable this feature.
Enable WP-Cron Event
Enable
Start Time
This setting controls the initial start time of the cron job. If the selected time has already passed, it will schedule the job for the following day at the selected time.
Interval
This setting controls the interval that the cron job should occur.
Note(s)
  • Enable HTTP compression in the “HTML” section on Browser Cache Settings tab.
example.com/wp-admin/admin.php?page=w3tc_minify
DashboardSettingsToolsInfoSupportUpgrade
||||||
Empty All Caches
General
Rewrite URL structure
If disabled, CSS and JS embeddings will use GET variables instead of “fancy” links. Learn more
Disable minify for logged in users
Authenticated users will not receive minified pages if this option is enabled. Learn more
Minify error notification:
Notify when minify cache creation errors occur. Learn more
HTML & XML
HTML minify settings:
Enable
Inline CSS minification
Inline JS minification
Don’t minify feeds
Line break removal
Enable HTML minification and optionally remove whitespace from inline CSS, JS, and feeds. Learn more
Ignored comment stems:
google_ad_
RSPEAK_
mfunc
Do not remove comments that contain these terms. Learn more
JS
JS minify settings:
Enable
Minify enqueued and inline JavaScript files according to the settings below. Learn more
Minify method:
Choose how JavaScript files should be combined or minified when using automatic mode. Learn more
Minify engine settings:
Operations in areas:
Embed type:
Before </head>
After <body>
Preserved comment removal (not applied when combine only is active)
Line break removal (not safe, not applied when combine only is active)
Control where scripts are placed and whether they stay blocking or load asynchronously for each template area. Learn more
HTTP/2 push
Enable
For better performance, send files to browser before they are requested when using the HTTP/2 protocol. Not supported by “Disk: Enhanced” page cache method for Nginx Learn more
CSS
CSS minify settings:
Enable
Minify stylesheets and inline CSS snippets declared in the queues below. Learn more
Minify method:
Choose how stylesheets should be combined or minified when using automatic mode. Learn more
Minify engine settings:
Preserved comment removal (not applied when combine only is active)
Line break removal (not applied when combine only is active)
Eliminate render-blocking CSS by moving it to HTTP body★ PRO
Website visitors cannot navigate your website until a given page is ready – reduce the wait time with this feature. Show More ▾
Decide where CSS is placed and whether it should load synchronously or asynchronously for each template area. Learn more
@import handling:
Control how @import rules are handled when combining and minifying stylesheets. Learn more
HTTP/2 push
Enable
For better performance, send files to browser before they are requested when using the HTTP/2 protocol. Not supported by “Disk: Enhanced” page cache method for Nginx Learn more
Advanced
Update external files every:
86400seconds
Specify the interval between download and update of external files in the minify cache. Hint: 6 hours is 21600 seconds. 12 hours is 43200 seconds. 24 hours is 86400 seconds. Learn more
Garbage collection interval:
86400seconds
If caching to disk, specify how frequently expired cache data is removed. For busy sites, a lower value is best.
Max interval is limited by the W3TC_CACHE_FILE_EXPIRE_MAX constant (2592000 seconds) which can be overridden in wp-config.php. Learn more
Never minify the following pages:
Always ignore the specified pages / directories. Use relative paths. Omit: protocol, hostname, leading forward slash and query strings. Learn more
Never minify the following JS files:
Always ignore the specified JS files. Use relative paths. Omit: protocol, hostname, leading forward slash and query strings. Learn more
Never minify the following CSS files:
Always ignore the specified CSS files. Use relative paths. Omit: protocol, hostname, leading forward slash and query strings. Learn more
Rejected user agents:
Specify user agents that will never receive minified content. Learn more
Include external files/libraries:
Specify external files/libraries that should be combined. Learn more
Use regular expressions for file name matching
If external script file names vary, use regular expressions in the “Include external files/libraries” field to simplify matching. Learn more
Purge via WP Cron
Enabling this will schedule a WP-Cron event that will flush the Minify Cache. If you prefer to use a system cron job instead of WP-Cron, you can schedule the following command to run at your desired interval: “wp w3tc flush minify”. Learn more
Minify is disabled! Enable it here to enable this feature.
Enable WP-Cron Event
Enable
Start Time
This setting controls the initial start time of the cron job. If the selected time has already passed, it will schedule the job for the following day at the selected time.
Interval
This setting controls the interval that the cron job should occur.
Note(s):
  • Enable HTTP compression in the “Cascading Style Sheets & JavaScript” section on Browser Cache Settings tab.
  • The TTL of page cache files is set via the “Expires header lifetime” field in the “Cascading Style Sheets & JavaScript” section on Browser Cache Settings tab.
example.com/wp-admin/admin.php?page=w3tc_dbcache
DashboardSettingsToolsInfoSupportUpgrade
||
Empty All Caches
Database caching via Disk is currently disabled.
General
Don’t cache queries for logged in users
Enabling this option is recommended to maintain default WordPress behavior. Learn more
Advanced
Maximum lifetime of cache objects:
180seconds
Determines the natural expiration time of unchanged cache items. The higher the value, the larger the cache. Learn more
Garbage collection interval:
3600seconds
If caching to disk, specify how frequently expired cache data is removed. For busy sites, a lower value is best. Learn more
Never cache the following pages:
Always ignore the specified pages / directories. Supports regular expressions (See FAQ). Learn more
Ignored query stems:
gdsr_
wp_rg_
_wp_session_
_wc_session_
Do not cache queries that contain these terms. Any entered prefix (set in wp-config.php) will be replaced with current database prefix (default: wp_). Query stems can be identified using debug mode. Learn more
Reject query words:
^\s*insert\b
^\s*delete\b
^\s*update\b
^\s*replace\b
^\s*create\b
^\s*alter\b
^\s*show\b
^\s*set\b
\bautoload\s+=\s+’yes’
\bsql_calc_found_rows\b
\bfound_rows\(\)
Do not cache queries that contain these words or regular expressions. Learn more
Reject constants:
APP_REQUEST
DOING_CRON
DONOTCACHEDB
SHORTINIT
XMLRPC_REQUEST
Disable caching once specified constants defined. Learn more
Enable for WP-CLI
Enable
WP-CLI already uses Memcached, Redis, and other persistent engines. Enable this only if your database cache engine is Disk and you want WP-CLI to use it. Learn more
Purge via WP Cron
Enabling this will schedule a WP-Cron event that will flush the Database Cache. If you prefer to use a system cron job instead of WP-Cron, you can schedule the following command to run at your desired interval: “wp w3tc flush db”. Learn more
Database Cache is disabled! Enable it here to enable this feature.
Enable WP-Cron Event
Enable
Start Time
This setting controls the initial start time of the cron job. If the selected time has already passed, it will schedule the job for the following day at the selected time.
Interval
This setting controls the interval that the cron job should occur.
example.com/wp-admin/admin.php?page=w3tc_objectcache
DashboardSettingsToolsInfoSupportUpgrade
|
Empty All Caches
Object caching via Disk is currently disabled.
Advanced
Default lifetime of cache objects:
180seconds
Determines the natural expiration time of unchanged cache items. The higher the value, the larger the cache. Learn more
Garbage collection interval:
600seconds
If caching to disk, specify how frequently expired cache data is removed. For busy sites, a lower value is best. Learn more
Global groups:
Groups shared amongst sites in network mode. Learn more
Non-persistent groups:
counts
plugins
Groups that should not be cached. Learn more
Enable caching for wp-admin requests
Enabling this option will increase wp-admin performance, but may cause side-effects Learn more
Store transients in database
Store transients in database even when external cache is used, which allows transient values to survive object cache cleaning/expiration Learn more
Enable for WP-CLI
Enable
WP-CLI already uses Memcached, Redis, and other persistent engines. Enable this only if your object cache engine is Disk and you want WP-CLI to use it. Learn more
Purge via WP Cron
Enabling this will schedule a WP-Cron event that will flush the Object Cache. If you prefer to use a system cron job instead of WP-Cron, you can schedule the following command to run at your desired interval: “wp w3tc flush object”. Learn more
Object Cache is disabled! Enable it here to enable this feature.
Enable WP-Cron Event
Enable
Start Time
This setting controls the initial start time of the cron job. If the selected time has already passed, it will schedule the job for the following day at the selected time.
Interval
This setting controls the interval that the cron job should occur.
example.com/wp-admin/admin.php?page=w3tc_browsercache
DashboardSettingsToolsInfoSupportUpgrade
||||
Empty All Caches
General
Specify global browser cache policy.
Set Last-Modified header
Set the Last-Modified header to enable 304 Not Modified response. Learn more
Set expires header
Set the expires header to encourage browser caching of files. Learn more
Set cache control header
Set pragma and cache-control headers to encourage browser caching of files. Learn more
Set entity tag (eTag)
Set the ETag header to encourage browser caching of files. Learn more
Set W3 Total Cache header
Set this header to assist in identifying optimized files. Learn more
Enable HTTP (gzip) compression
Reduce the download time for text-based files. Learn more
Enable HTTP (brotli) compression
Reduce the download time for text-based files. Learn more
Prevent caching of objects after settings change
Whenever settings are changed, a new query string will be generated and appended to objects allowing the new policy to be applied. Learn more
Remove query strings from static resources
Resources with a “?” in the URL are not cached by some proxy caching servers. Learn more
Prevent caching exception list:
Do not add the prevent caching query string to the specified URIs. Supports regular expressions. Learn more
Disable cookies for static files
Removes Set-Cookie header for responses. Learn more
Do not process 404 errors for static objects with WordPress
Reduce server load by allowing the web server to handle 404 (not found) errors for static files (images etc).
If enabled – you may get 404 File Not Found response for some files generated on-the-fly by WordPress plugins. You may add those file URIs to 404 error exception list below to avoid that. Learn more
404 error exception list:
robots\.txt
[a-z0-9_\-]*sitemap[a-z0-9_\.\-]*\.(xml|xsl|html)(\.gz)?
Never process 404 (not found) events for the specified URIs. Learn more
Rewrite URL structure of objects
Generate unique URI for each file protected from caching by browser. Learn more
CSS & JS
Specify browser cache policy for Cascading Style Sheets and JavaScript files.
Set Last-Modified header
Set the Last-Modified header to enable 304 Not Modified response. Learn more
Set expires header
Set the expires header to encourage browser caching of files. Learn more
Expires header lifetime:
31536000seconds
Specify how long CSS and JS files should be cached (in seconds). Learn more
Set cache control header
Set pragma and cache-control headers to encourage browser caching of files. Learn more
Cache Control policy:
Choose the Cache-Control policy applied to CSS and JS responses.
The Expires header already sets the max-age. Learn more
Set entity tag (eTag)
Set the ETag header to encourage browser caching of files. Learn more
Set W3 Total Cache header
Set this header to assist in identifying optimized files. Learn more
Enable HTTP (gzip) compression
Reduce the download time for text-based files. Learn more
Enable HTTP (brotli) compression
Reduce the download time for text-based files. Learn more
Prevent caching of objects after settings change
Whenever settings are changed, a new query string will be generated and appended to objects allowing the new policy to be applied. Learn more
Remove query strings from static resources
Resources with a “?” in the URL are not cached by some proxy caching servers. Learn more
Disable cookies for static files
Removes Set-Cookie header for responses. Learn more
HTML & XML
Specify browser cache policy for posts, pages, feeds and text-based files.
Set Last-Modified header
Set the Last-Modified header to enable 304 Not Modified response. Learn more
Set expires header
Set the expires header to encourage browser caching of files. Learn more
Expires header lifetime:
3600seconds
Max lifetime is limited by the W3TC_CACHE_FILE_EXPIRE_MAX constant (2592000 seconds) which can be overridden in wp-config.php. Learn more
Set cache control header
Set pragma and cache-control headers to encourage browser caching of files. Learn more
Cache Control policy:
Choose the Cache-Control policy applied to HTML and XML responses. Learn more
Set entity tag (ETag)
Set the ETag header to encourage browser caching of files. Learn more
Set W3 Total Cache header
Set this header to assist in identifying optimized files. Learn more
Enable HTTP (gzip) compression
Reduce the download time for text-based files. Learn more
Enable HTTP (brotli) compression
Reduce the download time for text-based files. Learn more
Media & Other Files
Set Last-Modified header
Set the Last-Modified header to enable 304 Not Modified response. Learn more
Set expires header
Set the expires header to encourage browser caching of files. Learn more
Expires header lifetime:
31536000seconds
Specify how long media and other files files should be cached (in seconds). Learn more
Set cache control header
Set pragma and cache-control headers to encourage browser caching of files. Learn more
Cache Control policy:
Choose the Cache-Control policy applied to media and other files responses.
The Expires header already sets the max-age. Learn more
Set entity tag (ETag)
Set the ETag header to encourage browser caching of files. Learn more
Set W3 Total Cache header
Set this header to assist in identifying optimized files. Learn more
Enable HTTP (gzip) compression
Reduce the download time for text-based files. Learn more
Enable HTTP (brotli) compression
Reduce the download time for text-based files. Learn more
Prevent caching of objects after settings change
Whenever settings are changed, a new query string will be generated and appended to objects allowing the new policy to be applied. Learn more
Remove query strings from static resources
Resources with a “?” in the URL are not cached by some proxy caching servers. Learn more
Disable cookies for static files
Removes Set-Cookie header for responses. Learn more
點選左側選單中亮起的項目或畫面上的按鈕。

1️⃣ 預覽模式

在實際部署快取變更之前,可以開啟預覽模式,預先測試是否有錯誤。

W3TC General Settings 預覽模式2

[Preview]:點選後可一邊預覽變更一邊測試,沒有問題再點選 [Deploy] 套用到網站。

2️⃣ 頁面快取

引導已將基本設定設為 [Disk: Enhanced]。之後若因搬遷伺服器等原因,伺服器使用的快取不同,可以再更改。

若是單一網站(非多站點)另外使用子網域,也可以為別名網域設定快取。

伺服器規格等級

更新間隔(秒)

每次間隔頁數

說明

低規格伺服器(1vCPU/1GB 以下)

1800 秒(30 分鐘)

5

需避免產生快取時 CPU 使用率飆升。間隔放寬,頁數也盡量減少

中等規格伺服器(2vCPU/2~4GB)

900 秒(15 分鐘)

10

建議維持預設值。可承受一定程度的同時處理

高效能伺服器(4vCPU/8GB 以上)

300 秒(5 分鐘)

20~30

可快速準備快取。適合流量高的網站

REST API 是 WordPress 為了與外部交換資料而提供的介面,可透過網址以 JSON 格式請求或操作內容。藉此,行動應用程式、外部網頁應用程式、區塊編輯器等都能即時同步或修改 WordPress 內容。

REST API 不只用於管理員,也用於一般使用者的請求,能讓資料傳輸更有效率,提高網站的彈性與擴充性。

選項

說明

推薦

延後初始化

允許呼叫 WordPress 函式以進行片段快取。

⚠️ 只在需要進階快取時使用

延後快取

將快取鍵的產生延後到使用者篩選器之後,可更細緻地設定快取

⚠️ 只在覆寫快取鍵時使用

相容模式

為了與主機相容而放棄部分優化(效能約降低 20%)

✅ 發生主機錯誤時建議使用

字元集

解決 UTF-8 相關的編碼問題

✅ 出現亂碼時建議使用

拒絕 HEAD 請求

防止 HEAD 請求產生空白快取

✅ 防止意外出現空白頁面

快取物件最長存留時間

已快取項目的保留時間(秒)

⏱ 流量少就設高,流量多就設低

垃圾回收間隔

移除過期快取資料的週期(秒)

⏱ 流量越多設得越短

留言 Cookie 存留時間

調整留言時的 Cookie TTL(預設 1800 秒)

✅ 想減少已登入使用者流量時很有用

3️⃣ Minify

Minify 會在 HTML、CSS、JS 檔案中 移除不必要的空白、註解與換行, 是一種縮小檔案大小、提升載入速度的技術。這個過程 不會改變功能 只讓程式碼更精簡, 使瀏覽器能更快解析。

選項

說明

推薦

自動

W3TC 會自動偵測並壓縮 HTML、CSS、JS 檔案。

✅ 適合大多數使用者

手動

必須由使用者自行輸入要壓縮的檔案路徑才會套用。

⚠️ 只適合需要精細控制的進階使用者

選項

說明

使用環境

磁碟(Disk)

將壓縮後的檔案存放在伺服器磁碟

✅ 一般共享主機,預設值

APC / APCu

利用 PHP 的 opcode 快取存放在記憶體

✅ 在專用/虛擬伺服器上效能佳

eAccelerator

舊式 PHP opcode 快取方式

⚠️ 只適用於舊型伺服器

XCache

PHP 的快取機制之一(幾乎沒人使用)

❌ 不建議(過時)

WinCache

Windows 伺服器用的 PHP 快取

✅ 僅限 IIS/Windows 伺服器

Memcached

存放在分散式快取伺服器

✅ 多伺服器、叢集環境

Redis

將壓縮檔案快取在快速的鍵值儲存

✅ 高效能 VPS/多伺服器環境

選項

說明

特色

Minify(預設)

W3TC 內建的 HTML 壓縮器
移除空白、換行與註解,縮小 HTML 大小

穩定性高,與大多數網站相容

HTML Tidy

整理 HTML 結構的同時進行壓縮
甚至會嘗試修正語法錯誤

含結構修正功能 → 有版面跑掉的風險

選項說明特色選擇 JS 壓縮器
JSMin(預設)簡單快速的 JS 壓縮器:移除基本的空白與註解穩定性高,衝突風險低✅ 重視速度/穩定性的一般 WordPress 網站
Google Closure Compiler(網路服務)Google 的進階 JS 優化工具:透過 Google API 壓縮準確度高,但需要 呼叫外部伺服器 → 可能較慢⚠️ 可使用外部 API、以精細優化為優先
Google Closure Compiler(本機 Java)將相同的壓縮引擎 放在伺服器內的 Java 環境中執行可進行進階優化, 需要安裝 Java✅ 可安裝 Java、想要進階優化時
Narcissus解析 JS 後重新產生的傳統壓縮器舊方式, 幾乎已停止支援—
YUI CompressorYahoo 開發的 JS/CSS 壓縮工具;可保留受保護的註解雖然老舊但仍穩定—
Closure(需測試)——⚠️ 大量使用新式 JS(ES6+)
選項說明
✅ Minify(預設)快速穩定,適合大多數 WordPress 網站
⚠️ CSS Tidy具備結構整理與語法修正功能,樣式可能跑掉 → 需測試
⚠️ YUI Compressor (PHP)舊版壓縮邏輯,已停止更新 → 僅限舊網站
⚠️ YUI Compressor (Java)需要 Java,可精細壓縮,但不支援新版 CSS 語法

引導已將基本設定設為 [Disk: Enhanced]。之後若因搬遷伺服器等原因,伺服器使用的快取不同,可以再更改。

項目

說明

重寫 URL 結構

CSS/JS 連結使用簡潔的 URL 結構。停用時會輸出成像 [?ver=xxx] 這樣 以 GET 參數為基礎 的 URL。

對已登入的使用者,
停用 Minify

已登入的使用者會看到 原始檔案,而不是壓縮後的檔案。適合除錯或開發時使用。

減少錯誤通知

建立 Minify 快取(Minify Cache)時若出錯會通知。停用後不顯示警告。

項目

說明

HTML 壓縮設定

壓縮 HTML 文件以縮小容量,會移除空白、縮排等。

壓縮行內 CSS

壓縮 [<style>] 標籤內的 CSS 程式碼。

壓縮行內 JS

壓縮 [<script>] 標籤內的 JS 程式碼。

不壓縮 Feed

RSS/Atom Feed(XML)不壓縮,維持原樣。

移除換行

移除 HTML 中的換行字元 → 檔案變小

範例

用途

google_ad_

保護 Google AdSense 廣告指令碼的註解

RSPEAK_

保護螢幕閱讀器/無障礙用的程式碼註解

mfunc

保護 W3TC 片段快取用的 [<!– mfunc –>] 註解

壓縮方式

說明

建議情境

合併 & 壓縮(Combine & Minify)

將多個 JS 檔案合併為一個並同時壓縮

✅ 一般情況下最有效
:檔案數減少 + 容量縮小

僅合併(Combine Only)

將多個檔案合併為一個,但不壓縮

⚠️ 擔心 JS 衝突時:避免壓縮造成的錯誤

僅壓縮(Minify Only)

保留檔案數量,分別壓縮每個檔案

⚠️ HTTP/2 環境 + 發生 JS 錯誤時
只想縮小容量、不想合併時

壓縮引擎設定

說明

插入位置:[</head>] 之前

將 JS 插入 [<head>] 內(在頁面載入前執行)

插入位置:[<body>] 之後

將 JS 插入頁面最下方(渲染後執行)

插入類型(Blocking / Non-blocking)

執行 JS 時是否暫停頁面渲染

項目

說明

建議設定

啟用 HTTP/2 Push

在瀏覽器請求之前,伺服器先主動推送 JS 檔案

✅ 若是 HTTP/2 環境可提升效能

注意事項

W3TC 的 Page Cache 若使用 [Disk: Enhanced] + NGINX,HTTP/2 Push ❌ 無法運作

✅ 在 Apache + HTTP/2 環境中運作最好

壓縮方式

說明

建議情境

合併 & 壓縮

合併 CSS 檔案後再壓縮

✅ 一般使用

僅合併

合併檔案但不壓縮

⚠️ 擔心 CSS 衝突時

僅壓縮

只壓縮、不合併

✅ 適合 HTTP/2 伺服器

壓縮引擎設定

說明

適用條件

移除受保護的註解(Preserved comment removal)

移除 CSS 檔案中的授權資訊或保留註解,以縮小容量。

⚠️ 只在 [合併 & 壓縮] 或 [僅壓縮] 時適用(※ [僅合併] 時不適用)

移除換行(Line break removal)

刪除 CSS 中的換行字元,產生更緊湊的檔案(檔案略微變小)

⚠️ 只在 [合併 & 壓縮] 或 [僅壓縮] 時運作(※ [僅合併] 時會被忽略)

@import 處理

說明

建議設定

None

保留 [@import] CSS 呼叫不變

❌ 不建議(會阻擋渲染)

Bubble

將 [@import] 移到 CSS 檔案最上方

⚠️ 效果有限

Process

將 [@import] 呼叫納入合併對象

✅ 建議(有提升效能的效果)

進階項目

說明

建議設定

外部檔案更新間隔(Update interval for external files)

W3TC 重新下載/壓縮 CDN 與外部網址 CSS/JS 檔案的間隔(秒)

✅ 維持預設 [86400] 秒(24 小時)※ 若有常變動的外部檔案,也可考慮 [21600](6 小時)

垃圾回收間隔(Garbage collection interval)

刪除過期快取檔案的週期(適用於磁碟快取)

✅ 建議 [43200~86400] 秒(流量大可再調低)※ 可在 [wp-config.php] 設定上限(2592000 秒)

不要壓縮下列頁面(Never minify the following pages)

輸入在壓縮中 一律排除的網址 (相對路徑,不含查詢字串)

✅ 視需要加入管理頁、登入頁、AJAX 網址等。例:[wp-login.php]、[wp-admin/]、[my-custom-endpoint/]

絕不壓縮的 JS 檔案

指定壓縮後會出錯的特定 JS 檔案

⚠️ 發現有問題的 JS 檔案時加入。例:[plugins/some-script.js]

絕不壓縮的 CSS 檔案

發生 CSS 衝突時可設為例外

⚠️ 若有會讓版面跑掉的 CSS,就設為例外。例:[themes/mytheme/style.css]

拒絕的使用者代理

不對特定 User-Agent(爬蟲、機器人等)提供壓縮後的檔案

✅ 只指定需要略過快取的機器人。例:[Lighthouse]、[GTmetrix]、[Chrome-Lighthouse] 等

包含外部檔案/函式庫(Include external files/libraries)

手動將外部 CDN 指令碼加入合併對象

⚠️ 只在想壓縮/合併外部 JS/CDN 時使用。例:[ajax.googleapis.com/…/jquery.min.js]

允許使用正規表示式

檔名模式不固定時,可用正規表示式比對

✅ 外部指令碼常因版本號而變動時很有用。例:[cdn.example.com/js/lib-\d+\.js]

# EX: 
#絕不壓縮的 JS 檔案:
plugins/some-plugin/assets/js/legacy-script.js
wp-includes/js/jquery/jquery.js

#絕不壓縮的 CSS:
themes/mytheme/style.css
# EX: 
#拒絕的使用者代理:
Lighthouse
Chrome-Lighthouse
GTmetrix

項目

說明

建議設定

使用 WP-Cron 事件(Enable WP-Cron event)

為了定期自動清除/更新頁面快取, 排程 WP-Cron 工作

✅ 建議啟用 (維持預設值)

開始時間(Start time)

WP-Cron 首次執行的時間(如 12:00 am)

✅ 伺服器負載低的時段(例:凌晨 12 點~3 點之間)

間隔(Interval)

WP-Cron 多久清除一次快取的 設定

✅ 每天兩次或每小時(流量大的網站)

替代方案:系統 Cron

可改用真正的作業系統層級 Cron 執行 [wp w3tc flush_posts] 指令,取代 WP-Cron

建議用於高效能伺服器(比 WP-Cron 更準確、更有效率)

4️⃣ opcode 快取

opcode 快取會自動套用伺服器上已安裝的 opcode。若未安裝,則設為停用。

5️⃣ 資料庫快取與物件快取:Memcached·Redis

選項

說明

建議環境

磁碟

將快取資料存放在伺服器磁碟

✅ 共享主機/基本環境

Memcached

以網路為基礎的分散式快取,速度快

✅ 多伺服器/叢集

一般的 WordPress 網站多半只用 Memcached 或 Redis 其中一個當資料庫快取,但在 W3 Total Cache 中可以分開運用:ⓐ 一個用於資料庫快取,ⓑ 另一個用於物件快取。

📌 一般的 WordPress 網站
├─ 資料庫 快取
│   └─ Memcached 或 Redis · 只選一個 使用
└─ 物件 快取
    └─ 相同 快取 引擎 共用 的情況 很常見

📌 W3 Total Cache (W3TC)
├─ 資料庫 快取
│   └─ Memcached 使用 (範例)
└─ 物件 快取
    └─ Redis 使用 (範例)

🛠️ 應用 策略
└─ 快取 引擎 依 角色 分離 套用 可以
    ├─ 伺服器 資源 分散
    ├─ 快取 瓶頸 減少
    └─ 效能 優化 彈性 提升

在 W3 Total Cache 的設定中,預設是資料庫快取使用 Memcached、物件快取使用 Redis。

項目

說明

建議或參考

快取物件的最長存留時間

未變更快取項目的自然到期時間(秒)

[180 秒](預設值),太大會浪費記憶體

垃圾回收間隔

刪除過期快取資料的週期(秒)

[3600 秒](1 小時),使用量大就調低

不要快取
下列頁面

排除快取的路徑(可用正規表示式)

建議排除登入、購物車、搜尋等動態頁面

忽略的查詢詞幹

前綴相符的查詢不快取

[gdsr_]、[wp_rg_] 等工作階段/暫存資料類

拒絕查詢(Query Rejects)

排除含特定關鍵字/模式的查詢(正規表示式)

[insert]、[update]、[autoload]、[found_rows()] 等

Reject Constants

定義了指定的 WP 常數時停用 DB 快取

[DOING_CRON]、[XMLRPC_REQUEST] 等

對 WP-CLI 啟用

WP-CLI 執行時是否也使用快取

✅ 啟用後效能較佳(測試環境要注意)

選項

說明

建議環境

磁碟

將快取資料存放在伺服器磁碟

✅ 共享主機/基本環境

Redis

以鍵值儲存為基礎的高速快取,與 PHP-FPM 環境搭配良好

✅ 高效能伺服器/VPS

W3TC 物件(Object)快取_進階設定 1

項目

說明

Redis 主機/IP

格式為 [127.0.0.1:6379]。TLS 請使用 [tls://] 前綴

驗證 TLS 憑證

使用 TLS 時檢查憑證有效性(選用)

使用持久連線

重複使用 Redis 連線以提升效能

連線逾時

連線到 Redis 允許的最長時間(秒)

連線重試間隔

失敗後到重試前的等待時間(ms)

連線讀取逾時

等待回應的最長時間(秒)

Redis DB ID

指定 Redis 內的 DB 編號(預設 [0])

Redis 密碼

輸入密碼或 SASL 驗證資訊

預設快取存留時間

快取項目的預設保留時間(秒)。預設 180 秒

垃圾回收間隔

刪除過期快取的週期。預設 600 秒

全域群組

網路模式下共用的群組(多站點用)

非持久群組

排除快取的群組。例:[counts]、[plugins]

快取 wp-admin 請求

管理區也套用快取(⚠️ 需測試)

將 transient 存入 DB

即使使用外部快取,也在 DB 保留暫存值

啟用 WP-CLI

WP-CLI 指令也允許啟用快取

6️⃣ 瀏覽器快取

瀏覽器快取會把圖片、CSS、JS 等靜態檔案存放在 訪客的裝置上,大幅縮短再次造訪時的載入時間,進而提升頁面回應速度與使用者體驗。

大部分是著重於 快取控制與降低伺服器負載的設定。網站流量大,或重視靜態資源優化的環境,多數開啟也無妨。

項目一般CSS 與 JSHTML 與 XML媒體與其他檔案
設定 [Last-Modified] 標頭加入檔案的最後修改日期,以允許 304 回應✅ 大多啟用✅ 適合大多數伺服器✅ 對大多數 CDN/瀏覽器快取有效
設定 [Expires] 標頭讓瀏覽器在一定期間內快取檔案✅ 預設 31536000 秒(1 年),建議✅ 預設 [3600 秒(1 小時)] ✅ 預設 [31536000 秒](1 年)→ 適合靜態檔案
⏱️ 設定 Expires 到期時間—⏱️ 例:[31536000 秒 = 1 年] · 與 CDN 併用時可調短——
設定 [Cache-Control] 標頭透過加入 pragma、cache-control 標頭控制快取策略✅ 建議 [“public, max-age=31536000”]✅ 設為 [“public, max-age=3600”] 等✅ 建議 [“public, max-age=31536000”]
✅ 快取控制策略—✅ 使用包含 [max-age] 的方式 · 預設使用 [“public, max-age=EXPIRES_SECONDS”]——
設定 [ETag]提供識別檔案用的實體標籤 – 用於偵測變更✅ 在同一伺服器內使用時有效✅ 伺服器之間沒有共用快取時,
建議使用
✅ 單一伺服器運作時有用
設定 W3TC 標頭插入用來辨識是否為 W3TC 優化檔案的標頭🔖 非必要,供分析用🔖 非必要(除錯用)🔖 可自行選擇是否使用
gzip 壓縮用來縮小文字檔容量的壓縮方式(大多相容)✅ 大部分伺服器都支援✅ 大多數伺服器都有支援✅ 對圖片沒有影響
brotli 壓縮壓縮率比 gzip 更高的方式(僅限支援的瀏覽器)✅ 需要設定 Apache/Nginx✅ 啟用 Apache/nginx 模組✅ 僅適用於支援的瀏覽器
變更設定時防止快取物件加上查詢字串讓舊快取失效✅ 設定經常變更時建議使用—✅ 檔案變更會立即反映
移除查詢字串移除靜態資源中的 [?],提高快取率⚠️ 只有部分 CDN/代理需要—✅ 可套用於有版本管理的檔案
移除 Cookie移除靜態資源回應中的 [Set-Cookie] 標頭✅ 大多數情況下勾選—✅ 圖片等不需要 Cookie
不由 WordPress 處理 404 回應靜態檔案的 404 交給網頁伺服器處理 → 減輕 WP 負載———
404 例外 URI 清單指定由 WP 直接處理的特定 URI 模式(例:sitemap、robots.txt 等)———
重寫物件 URL 結構產生唯一 URI 以略過快取(如 [ver=xxxx] 形式)———

Ⅲ. W3 Total Cache 附加功能

  • ↳ WP Cron、CDN、反向代理、使用者體驗、統計、WebP 轉換器、Google PageSpeed、匯入/匯出設定

使用 WP Cron 清除快取屬於 全域設定。

🧭 W3 Total Cache 附加功能模擬器
路徑模擬器
📍Performance›General Settings›Purge via WP Cron
WP Cron
使用 WP Cron 清除快取屬於全域設定,用來決定開始時間與間隔。
📍Performance›General Settings›CDN›Advanced Settings
CDN
註冊 CDN 服務商後,勾選 [CDN] 的 [Enable]、選擇 [CDN Type] 並儲存;細部項目在 [Advanced Settings] 設定。
📍Performance›General Settings›Reverse Proxy
反向代理
只有使用 Varnish 時才勾選 [Enable reverse proxy caching via varnish]。在 [Varnish servers] 輸入 Varnish 伺服器的 IP 位址。
📍Performance›General Settings›User Experience›Advanced Settings
使用者體驗
勾選 [Lazy Load Images] 並儲存後,到 [Advanced Settings] 設定延遲載入項目。進階設定中超過 50% 的功能要在付費版才能使用。
📍Performance›General Settings›Image Converter
WebP 轉換器
勾選 [Image Converter] 的 [Enable Image Converter Extension] 後,就能把媒體庫的圖片轉換成 WebP 或 AVIF 格式。
example.com/wp-admin/admin.php?page=w3tc_general
DashboardSettingsToolsInfoSupportUpgrade
|||||||||||||||||
Empty All Caches
Purge via WP Cron
Enabling this will schedule a WP-Cron event that will flush all enabled Caches via a single cron job. Each cache’s advanced settings page features similar settings to this if you wish to schedule purges for specific caches only. If you prefer to use a system cron job instead of WP-Cron, you can schedule the following command to run at your desired interval: “wp w3tc flush all”. If the Always Cached extension is active and enabled, page cache entries will instead be added to the queue instead of being purged from the cache. Visit here for more information.
Enable WP-Cron Event
Enable
Start Time
This setting controls the initial start time of the cron job. If the selected time has already passed, it will schedule the job for the following day at the selected time.
Interval
This setting controls the interval that the cron job should occur.
CDN
Content Delivery Network (CDN) is a powerful feature that can significantly enhance the performance of your WordPress website. By leveraging a distributed network of servers located worldwide, a CDN helps deliver your website’s static files, such as images, CSS, and JavaScript, to visitors more efficiently. This reduces the latency and improves the loading speed of your website, resulting in a faster and smoother browsing experience for your users. With W3 Total Cache’s CDN integration, you can easily configure and connect your website to a CDN service of your choice, unleashing the full potential of your WordPress site’s speed optimization.
Basic SettingsPremium ServicesHelp
CDN:
Theme files, media library attachments, CSS, and JS files will load quickly for site visitors.
CDN Type:
Select the CDN type you wish to use.
Host the entire website with your compatible CDN provider to reduce page load time.
FSD CDN:
Enable★ PRO
Deliver visitors the lowest possible response and load times for all site content including HTML, media (e.g. images or fonts), CSS, and JavaScript. Show More ⌄ Learn more about Pro
Reverse Proxy
A reverse proxy is a server that sits between a client and a web server, acting as an intermediary for requests. It retrieves resources on behalf of the client from the server, and then returns the response to the client. By utilizing a reverse proxy, such as Varnish or Nginx, in conjunction with W3 Total Cache, you can significantly enhance the performance of your WordPress website by caching and serving static content directly from the reverse proxy server, reducing the load on your WordPress server and improving response times for visitors.
Enable reverse proxy caching via varnish
Varnish servers:
Specify the IP addresses of your varnish instances above. The VCL’s ACL must allow this request.
Trusted reverse proxies:
IP addresses or CIDR ranges of reverse proxies and load balancers in front of this site (one per line). Forwarded scheme and client-IP headers are used only for these addresses. Leave empty when PHP receives client connections directly. Developers may also supply this list via the w3tc_trusted_proxies filter.
User Experience
User Experience (UX) is a setting that focuses on enhancing the overall browsing experience for visitors of your website. By enabling this feature, you can optimize your website’s performance by minimizing load times, reducing server requests, and delivering content more efficiently. This ultimately leads to faster page loading, improved user satisfaction, and increased engagement, resulting in a speedier and more enjoyable WordPress website.
Basic Settings
Defer loading offscreen images.
Lazy Load Google Maps★ PRO
In addition to lazy loading images, with W3 Total Cache Pro you can lazy load Google Maps! More information and settings can be found on the User Experience page.
Disable Emoji
Remove emojis support from your website.
Delay Scripts★ PRO
Delay the loading of specified internal/external JavaScript sources on your pages separate from Minify.
Remove Unwanted/Unused CSS/JS★ PRO
Removes specified CSS/JS tags from the homepage or on a per page basis.
Preload Requests★ PRO
DNS prefetching, pre-connecting, and preloading are essential web optimization techniques that enhance website performance by proactively resolving network-related tasks. Learn more about Pro
Disable wp-embed script
Remove wp-embed.js script from your website. oEmbed functionality still works but you will not be able to embed other WordPress posts on your pages.
Disable jquery-migrate on the front-end
Remove jquery-migrate support from your website front-end.
Image Converter
The Image Converter tool can be used to generate modern-format versions (e.g., WebP or AVIF) of media library images which offer superior lossless and lossy compression.
Enable Image Converter Extension
This extension allows for optimizing media library images to modern formats like WebP or AVIF.
As a free user you are limited to conversions of 10/hour and 100/month. The Pro license increases these rates to 10,000/hour and unlimited/month. Conversion rates are subject to change and documentation can be found here. Learn more about Pro
example.com/wp-admin/admin.php?page=w3tc_cdn
DashboardSettingsToolsInfoSupportUpgrade
||
Empty All Caches
General
Host attachments
Upload attachments
If checked, all attachments will be hosted with the CDN.
Host wp-includes/ files
Upload includes files
If checked, WordPress static core file types specified in the “wp-includes file types to upload” field below will be hosted with the CDN.
Host theme files
Upload theme files
If checked, all theme file types specified in the “theme file types to upload” field below will be hosted with the CDN.
Host minified CSS and JS files
Upload minify files
If checked, minified CSS and JS files will be hosted with the CDN.
Host custom files
Upload custom files
If checked, any file names or paths specified in the “custom file list” field below will be hosted with the CDN.
Force over-writing of existing files
If modified files are not always detected and replaced, use this option to over-write them.
Advanced
Only purge CDN manually
Purge CDN only if explicit purge button is clicked.
Disable CDN on SSL pages
When SSL pages are returned no CDN URLs will appear in HTML pages.
Use CDN links for the Media Library on admin pages
All Media Library content will use CDN links on administration pages.
Add CORS header
Add CORS headers to allow cross-domain assets usage.
Disable CDN for the following roles
Select user roles that will use the origin server exclusively:
Administrator
Editor
Author
Contributor
Subscriber
Disable CDN on the following pages:
Always ignore the specified pages / directories. Supports regular expression.
Automatically upload minify files
If CDN is enabled (and not using the origin pull method), your minified files will be automatically uploaded.
Export changed files automatically
Automatically attempt to find and upload changed files.
Auto upload interval:
3600seconds
Specify the interval between upload of changed files.
Re-transfer cycle interval:
900seconds
The number of seconds to wait before upload attempt.
Re-transfer cycle limit:
25
Number of files processed per upload attempt.
wp-includes file types to upload:
*.css;*.js;*.gif;*.png;*.jpg;*.xml
Specify the file types within the WordPress core to host with the CDN.
Theme file types to upload:
*.css;*.js;*.gif;*.png;*.jpg;*.ico;*.ttf;*.otf;*.woff;*.woff2;*.less
Specify the file types in the active theme to host with the CDN.
File types to import:
 
Automatically import files hosted with 3rd parties of these types (if used in your posts / pages) to your media library. Only common static types (images, CSS, JS, fonts, and media) are imported. Script, markup, and SVG types are ignored even if listed. Empty, *, and *.* use that static allowlist rather than every file.
Custom file list:
favicon.ico
{wp_content_dir}/gallery/*
{wp_content_dir}/uploads/avatars/*
{plugins_dir}/wordpress-seo/css/xml-sitemap.xsl
{plugins_dir}/wp-minify/min*
{plugins_dir}/*.js
{plugins_dir}/*.css
{plugins_dir}/*.gif
{plugins_dir}/*.jpg
{plugins_dir}/*.png
Specify any files outside of theme or other common directories to host with the CDN.
Rejected user agents:
Specify user agents that should not access files hosted with the CDN.
Rejected files:
{uploads_dir}/wpcf7_captcha/*
{uploads_dir}/imagerotator.swf
{plugins_dir}/wp-fb-autoconnect/facebook-platform/channel.html
Specify the path of files that should not use the CDN.
Set cookie domain to “example.com”
If using subdomain for CDN functionality, this setting helps prevent new users from sending cookies in requests to the CDN subdomain.
Note(s):
  • You can use placeholders {wp_content_dir}, {plugins_dir}, {uploads_dir} instead of writing folder paths (wp-content, wp-content/plugins, wp-content/uploads).
  • If using Amazon Web Services or Self-Hosted CDN types, enable HTTP compression in the “Media & Other Files” section on Browser Cache Settings tab.
example.com/wp-admin/admin.php?page=w3tc_userexperience
DashboardSettingsToolsInfoSupportUpgrade
Empty All Caches
Lazy loading is currently disabled.
Lazy Loading
Process HTML image tags
Process img tags
Process background images
Process background styles
Exclude words:
avia-bg-style-fixed
data-bgposition=
data-envira-src=
data-large_image=
data-lazy-original=
data-lazy-src=
data-lazyload=
data-lazysrc=
data-no-lazy=
data-src=
data-srcset=
fullurl=
lazy-slider-img=
loading=”eager”
no-lazy
rev-slidebg
skip-lazy
soliloquy-image
swatch-img
w3-total-cache
woocommerce/assets/images/placeholder.png
wpcf7_captcha
Exclude tags containing words
Threshold
 
The outer distance off the scrolling area from which to start loading the elements (example: 100px, 10%).
Script Embed method:
Use inline method only when your website has just a few pages
Google Maps
Lazy load google map
WP Google Map Plugin plugin
Google Maps Easy plugin
WP Google Maps plugin
點選左側選單中亮起的項目或畫面上的按鈕。

1️⃣ CDN

註冊 CDN 服務商後即可設定此功能。

選項

說明

✅ 託管附件

將 [wp-content/uploads] 內的圖片等附件上傳到 CDN

✅ 託管 wp-includes 檔案

將 WordPress 核心靜態檔案(js/css 等)納入 CDN

✅ 託管佈景主題檔案

將使用中佈景主題的靜態檔案(css/js/images 等)納入 CDN

✅ 託管壓縮後的 CSS/JS 檔案

從 CDN 提供 W3TC 壓縮過的 CSS/JS 檔案

✅ 託管自訂檔案

將使用者自行指定的路徑或檔名推送到 CDN

⚠️ 強制覆寫既有檔案

修改未被自動偵測到時,用來強制重新上傳

項目

說明

僅手動清除 CDN

只有點選手動清除按鈕時才從 CDN 移除檔案

在 SSL 頁面停用 CDN

HTTPS 頁面不使用 CDN 網址

在管理後台使用 CDN 連結

在管理畫面中也為媒體顯示 CDN 網址

Add CORS header

加入允許 CORS 的回應標頭

依角色停用 CDN

對選定的使用者角色不套用 CDN(例:只有管理員使用原始檔)

頁面排除清單

將指定路徑排除於 CDN(可用正規表示式)

自動上傳壓縮檔案

自動將 Minify 後的檔案上傳到 CDN(Push 方式)

自動匯出變更的檔案

偵測到檔案修改時自動上傳

自動上傳間隔

偵測到檔案變更後的上傳間隔(預設 3600 秒)

重新傳送間隔/限制

失敗時的重試間隔與處理檔案數限制

要上傳的 wp-includes 檔案

指定要納入 CDN 的核心檔案格式

要上傳的佈景主題檔案格式

指定 CSS/JS/字型等佈景主題相關的檔案格式

要匯入的檔案格式

指定外部連結檔案的自動下載條件

自訂檔案清單

指定要傳送到 CDN 的個別檔案路徑(範本、外部外掛等)

拒絕的使用者代理

指定禁止存取 CDN 檔案的機器人/使用者代理

拒絕的檔案路徑

指定 CAPTCHA、特殊路徑等不套用 CDN 的檔案路徑

設定 Cookie 網域

使用子網域 CDN 時,指定網域以避免傳送 Cookie

2️⃣ 反向代理

說明中以 Varnish 和 Nginx 為例,但 Nginx 是在伺服器上設定,因此只有使用 Varnish 時才在 W3 Total Cache 外掛中套用。

3️⃣ 使用者體驗:延遲載入

進階設定中超過 50% 的功能要在付費版才能使用。

項目

說明

建議使用時機

✅ 處理 HTML 圖片標籤

[<img>] 標籤會加上 lazy 屬性

一般內容圖片延遲載入時

✅ 處理背景圖片

對 CSS 的 [background-image] 套用 lazy

背景圖片多的設計類網站

排除字詞範例
Lazy 排除屬性[data-src]、[data-lazy-src]、[data-no-lazy]、[loading=”eager”] 等
Lazy 排除類別[no-lazy]、[skip-lazy]、[lazy-slider-img]、[rev-slidebg] 等
外掛/輪播相關[soliloquy-image]、[envira]、[w3-total-cache]、[wpcf7_captcha] 等
WooCommerce 相關[swatch-img]、[woocommerce/…/placeholder.png] 等

延遲載入的「門檻」是設定瀏覽器視窗(畫面)下方的圖片或背景元素,要在多遠的距離就預先載入的值。例如設為 100px 時,使用者捲動到距離該元素 100 像素以內就會載入;設得太短會讓圖片載入變慢,使用者可能看到一片空白,因此通常 100~300px 之間較適當。

以下是指令碼的嵌入方式。

嵌入方式

說明

位置或屬性

非同步(Async)

與頁面載入平行執行,不會阻擋渲染

[<script async>]

同步(放在 head)

在 [<head>] 區域先執行,可能暫時阻擋渲染(in the head)

[<head>] 或 [<script>]

行內(Inline)

直接在 HTML 文件中插入指令碼,不需另外請求即可執行

插入 [<script>程式碼</script>] 內

W3TC 使用者體驗進階設定 2
W3TC 使用者體驗進階設定 3

4️⃣ WebP 轉換器

W3TC WebP 轉換器_詳細(進階設定)1
W3TC WebP 轉換器_詳細(進階設定)2

Ⅳ. W3 Total Cache 綜合評價

W3 Total Cache 的介面(UI)不算差,但確實不方便。許多開發者與專業使用者也指出同樣的問題。與 WP Rocket、FlyingPress 等新式外掛相比, 網站效能完全跟得上,但在使用者體驗(UX)方面仍有不足。

功能多是優點,但 對新手來說,結構可能過於複雜。特別是需要頻繁切換選單、細部選項又多,即使是熟練的開發者和網站管理員 也可能設定出錯。設定過的內容當然無法全部記住,但正因如此,在使用上它是 可以細緻調整的進階快取外掛。

免費版安裝數超過 100 萬,很難只把它當成老舊外掛;事實上,幾乎找不到功能多樣、豐富程度能與之匹敵的快取外掛。

項目評分(⭐)評價內容
🎛️ 介面⭐⭐⭐選單多、結構複雜,新使用者門檻高。UI 感覺老舊
⚙️ 功能多樣性⭐⭐⭐⭐⭐快取、CDN、Redis 等幾乎所有功能,很難找到沒有的功能
🛠️ 細部設定彈性⭐⭐⭐⭐幾乎所有功能都能細部調整,需注意設定之間的衝突
🚀 效能提升效果⭐⭐⭐⭐⭐設定優化後效能非常好,物件快取/瀏覽器快取效果大
🧩 相容性⭐⭐⭐可能與部分主機、佈景主題、外掛衝突。
📄 文件·指南⭐⭐⭐⭐⭐官方文件豐富
💡 使用者推薦度⭐⭐⭐⭐(4.5)推薦給進階使用者。新手推薦 WP Rocket、Cache Enabler 等
📊 綜合評分⭐⭐⭐⭐(4.5)以功能為主的高效能外掛。有學習曲線,需考量使用者程度

Ⅴ. 效能測試

外掛設定完成後的最終速度測試顯示,速度提升比一般快取外掛更明顯。

ℹ️ 聯盟行銷說明
本站內容包含聯盟行銷連結。訪客透過這些連結購買商品或服務時,本站會從賣家獲得佣金。在這個過程中,購買者支付的金額(遇到活動折扣時金額會降低↓)並不會因此提高。刊登的價格、折扣與庫存資訊以撰寫當時為準,可能與實際情況不同,購買前請向賣家做最後確認。商品的挑選與評價依本站自訂的標準撰寫,是否支付佣金不會影響介紹順序或評價內容。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

Prove your humanity: 9   +   10   =