Push Block Changes to Global Styles – WP Tavern


Gutenberg 14.9 was released this week with a powerful new site editing feature that allows users to push individual block changes to global styles.

Whenever WordPress makes it easy for users to design their own sites, there’s always the lingering concern – will tools be inadvertently used to create wild, exotic GeoCities-style sites? For example, if a user makes a change to the heading template on the page template, it will not be automatically enabled for headings in the other templates, which can create inconsistent design across the website.

The new “Push Changes to Global Styles” button allows users to apply the same change to all blocks of this type. In the example below, the H1 has been updated to have a lime green background with red text. Within the Advanced panel in block settings, a new button appears to push changes to Global Styles.

It is important to note that the feature only works within the site editor. Users writing posts and pages will not have the ability to push changes to global styles. The new button gives users a quick way to update blocks across the site without having to manually modify each template or figure out the appropriate CSS for the application.

Other significant changes in 14.9 include printing support for the page list block, a new option to import sidebar widgets into the template pane when switching from the classic theme, and the word count/time to read meta information has been moved to the top of the outline.

New features for theme authors

Gutenberg 14.9 introduces support for shadow presets in theme.json, with two default presets bundled (Natural and Sharp). Theme authors can learn how to do this and create custom shadow box presets, or wait for an upcoming tutorial on the topic. The 14.9 post includes a screenshot of how this feature is implemented:

Theme authors now have the ability to set the minimum font size for flex typography in theme.json. It is currently encoded to 14px by default, which may not work for all designs.

Another new tool for template developers is the ability to register styles for specific templates, which will limit where they appear. This has been added via a new templateType property in the pattern registration API. Theme developers can restrict styles to only appear for templates where they make sense, like 404, single post templates, single product, and category templates, for example.

Check out the v14.9 post to see all the bug fixes and improvements to the editor, accessibility, performance, tools, and more.