Skip to content

Instantly share code, notes, and snippets.

View gziolo's full-sized avatar
⛹️

Greg Ziółkowski gziolo

⛹️
View GitHub Profile
@gziolo
gziolo / dev-note-5.8-block-editor.md
Last active March 7, 2023 00:50
Block Editor filter changes in WordPress 5.8

Block Editor Changes

We have reached the first WordPress core release where the post editor is no longer the only screen that uses the block editor. In the middle of the development process, we found out that several WordPress hooks defined on the server depended on the $post object that isn’t present on the updated screen that lets users edit widgets using blocks. Therefore, we decided to deprecate some of the existing filters and introduce their context-aware replacements. This way, we ensure that we can continue iteratively enabling the block-based paradigm on different screens like the navigation editor screen by leveraging the new WP_Block_Editor_Context class that will receive more capabilities over time. There are also new methods introduced that allow code reuse for the functionality that needs to be shared between the screen that uses the block editor.

Related Trac ticket: #52920.

Class

WP_Block_Editor_Context

@gziolo
gziolo / dev-note-5.8-block-api.md
Last active September 26, 2023 19:46
Block API enhancements in WordPress 5.8

Block API Enhancements

As of WordPress 5.8 release, we encourage using block.json file metadata as the canonical way to register block types. We have been working on Block Metadata specification for a few major WordPress releases, and we reached the point where all planned features are in place.

Example:

notice/block.json

{
	"apiVersion": 2,