Gutenberg 16.4 Introduces Experimental Auto-Inserting Blocks

Gutenberg 16.4 Introduces Experimental Auto-Inserting Blocks

Posted by WP Tavern on August 27, 2023 at 1:23 pm
kitty kitty CATegory News
Gutenberg 16.4 has been released with a new auto-inserting blocks experimental feature. It allows developers to specify a location in which the block will be automatically inserted, such as before or after a template. The block can then be repositioned after insertion using the editor tools. “This applies both to the frontend and to the Site Editor (via the REST API), allowing for further user customization,” Automattic-sponsored engineer Sarah Norris said in the 16.4 release post. She posted a video demonstrating how it works with an example “like” block: video source: Gutenberg 16.4 release post Although the auto-inserting blocks is still behind the experimental flag, developers can try it by adding an __experimentalAutoInsert field to the block.json file of a dynamic block. Example code is available in the release post. “This feature aims to improve the extensibility of block themes through plugins and continues to be actively developed,” Norris said. The GitHub ticket for auto-inserting blocks describes a common scenario from the days of classic themes where a plugin would use a filter to auto-append a login/logout link to a navigation menu. This is no longer possible with block themes, so contributors have devised auto-inserting blocks as a creative solution that retains ease of…

…Full post on WP Tavern
Read Full

Similar Posts

Leave a Reply