Ollie Theme Academy

Curating the Editor Experience

Removing blocks for post types and editors – B

Target specific editors using early returns in your block filtering functions. Check the editor context name and return default behavior for non-targeted editors while applying restrictions to specific contexts.

Use block registry data to filter blocks by category, type, or other properties. Get all registered blocks, filter by criteria (like removing widget category blocks), and return the filtered array.

Transform block objects to block slugs using array_keys() since the filter expects an array of block type identifiers rather than block objects or metadata.

This approach creates editor-specific block restrictions while maintaining normal functionality in other editing contexts, providing targeted curation without global limitations.

Back to: Ollie Theme Academy > Curating the Editor Experience