Hi,
the new editor.js injection doesn’t allow to do block style unregistration.
I tested adding this code below in editor.js but it never fired.
Distinct script loaded with the hook enqueue_block_editor_assets play well (but quite strange this enqueue generate a js error inside the editor.js which import a js file doing a createHigherOrderComponent)
Thank you
domReady(() => {
const unregisterStyledBlocks = \[{blockName: 'core/button', styleName: 'outline'}\];
unregisterStyledBlocks.forEach(block => {
wp.blocks.unregisterBlockStyle(block.blockName, block.styleName);
});
});
ben
April 15, 2026, 4:49pm
2
Known bug with wp.domReady:
opened 10:13AM - 15 Sep 20 UTC
[Type] Bug
[Package] DOM ready
[Package] Blocks
**Describe the bug**
Since updating to Wordpress 5.5, `wp.blocks.unregisterBloc… kStyle('core/separator', 'wide');` no longer works within `window.wp.domReady`
**To reproduce**
Steps to reproduce the behavior:
Enqueue the following js:
```js
window.wp.domReady(function() {
wp.blocks.unregisterBlockStyle('core/separator', 'dots');
wp.blocks.unregisterBlockStyle('core/separator', 'wide');
});
```
**Expected behavior**
The styles should be disabled, but they aren't. Running `wp.blocks.unregisterBlockStyle('core/separator', 'dots');` in the browser console works, so it must be race condition, or `wp.domReady` is no longer firing late enough.
**Editor version (please complete the following information):**
- WordPress version: 5.5.1
- Using default editor
**Desktop (please complete the following information):**
- OS: Windows 10
- Browser: chrome
- Version : recent
From the replies:
Calling it using window.onload works