Enable Global Styles
Enables the full Global Styles editor in the Site Editor for classic and hybrid themes.
by blocklayouts · github.com/qarayahya/enable-global-styles · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/qarayahya/enable-global-styles/archive/refs/heads/main.zipReadme
Enable Global Styles
Enables the full Global Styles editor in the Site Editor for classic and hybrid themes.
Classic and hybrid themes (classic themes with a theme.json) only get a read-only Style Book in the Site Editor (site-editor.php?p=/stylebook) — there is no Styles editing page (?p=/styles) like block themes have. WordPress still stores user style customizations in the wp_global_styles custom post type for every theme, so the data layer fully supports editing them.
This plugin replaces the static /stylebook route with a full Styles editing page:
- The Global Styles UI (colors, typography, layout, per-block styles) in the content column — the same component block themes use.
- A live Style Book preview that reflects unsaved changes as you edit.
- Saving goes through the regular Site Editor Save flow, because edits are made via
editEntityRecord( 'root', 'globalStyles', … ).
The existing "Styles" item in the Site Editor's main sidebar already points to /stylebook for classic themes, so the page is reachable without modifying the sidebar.
How it works
- The script loads only on
site-editor.php, and only when the active theme is not a block theme. - It opts into WordPress private APIs (
__dangerousOptInToUnstableAPIsOnlyForCoreModules) to obtainunlock. - It unlocks
GlobalStylesUIWrapper,GlobalStylesActionMenu,StyleBookPreview, anduseGlobalStylesfrom@wordpress/editor's private APIs, plususeLocation/useHistoryfrom@wordpress/router. - Once the Site Editor registers its routes, it dispatches the private
unregisterRoute( 'stylebook' )/registerRoute( … )actions on thecore/edit-sitestore to swap the route.
⚠️ Because this relies on private APIs (the consent string is version-pinned), it may need updating with future WordPress releases. Built and tested against WordPress 7.0.
Development
npm install
npm run build