內容簡介
外掛目的
這個外掛程式可以修復 WordPress 5.9 引入的樣式問題。
👍 適合使用外掛程式的情況
✅ 您使用的 WordPress 版本是 5.9 或更新
✅ 您正在使用支援區塊編輯器(Gutenberg)功能的佈景主題,例如預設字型大小和色彩調色盤
✅ 您的佈景主題尚未支援全站編輯(FSE)功能(從報告問題的討論來看,這些問題只影響支援 Gutenberg 的佈景主題,而 FSE 佈景主題應該不會有這個問題)
✅ 在 WordPress 5.9 更新後,您的網站出現了字型大小或色彩問題
✅ 您的佈景主題尚未更新以修復這些問題
✋ 不適合使用外掛程式的情況
您沒有使用 WordPress 5.9 或更新版本
您的佈景主題已更新並修復了問題
您的佈景主題不支援區塊編輯器功能(例如預設色彩調色盤或字型大小)
您的佈景主題是全站編輯(FSE)即準備好的
在更新到 WordPress 5.9 後,您的網站沒有出現任何字型大小或色彩問題
技術資訊
WordPress 5.9 開始將 !important 規則應用於全局樣式代碼中的 body 選擇器中的 CSS 屬性(CSS 變量)。這會增加全局樣式的優先級,可能會覆蓋來自佈景主題和外掛的樣式。(有關此更改的更多信息,請查看 「Settings, Styles, and theme.json 更新」文章。)
Global Styles Mods 外掛可以通過刪除 !important 規則和將 body 更改為 :root 選擇器以設置 WordPress CSS 屬性(CSS 變量)從而降低 WordPress 5.9 全局 CSS 樣式的優先級。
此外,它可以提前啟動全局樣式,以便您的佈景主題或外掛樣式表有更好的覆蓋全局樣式的機會。
此修復來自於Gutenberg GitHub 存儲庫的討論中。
外掛標籤
開發者團隊
② 後台搜尋「Global Styles Mods – WordPress 5.9 fix」→ 直接安裝(推薦)
原文外掛簡介
Plugin’s purpose
This plugin fixes styling issues introduced in WordPress 5.9.
👍 When to use this plugin
✅ Your WordPress is of version 5.9 or newer
✅ You are using a theme that supports block editor (Gutenberg) features such as preset font sizes and color palette
✅ Your theme does not support full site editing (FSE) feature (from conversation about reported issues it seems they affect Gutenberg-ready themes only and FSE themes should be fine)
✅ You experience font size or color issues on your website after WordPress 5.9 update
✅ Your theme has not been updated to fix these issues
✋ When NOT to use this plugin
You are not using WordPress 5.9 or newer
Your theme was updated and is fixing the issues
Your theme does not support block editor features (such as preset color palette or font sizes)
Your theme is full site editing (FSE) ready
You don’t experience any font size or color issues on your website after updating to WordPress 5.9
Technical info
WordPress 5.9 started applying !important rule and is setting up CSS properties (CSS variables) within body selector in its global styles code. This rises the global styles specificity and may override styles coming from themes and plugins. (For more info about this change check “Updates for Settings, Styles, and theme.json” article.)
Global Styles Mods plugin lowers the specificity of WordPress 5.9 global CSS styles by removing !important rules and changing body to :root selector for setting up WordPress CSS properties (CSS variables).
It also enqueues the global styles early enough so your theme or plugin stylesheet have a better chance to override global styles with minimal effort.
The fix applied is coming from issue conversation in Gutenberg GitHub repository.
