“wp.blocks.unregisterBlockType” doesn’t work without “wp-edit-post” in 5.8
-
I have a problem with the new widgets editor / with the deactivation of individual blocks in my base theme. After the update to 5.8 I got the message:
"wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets)
.I also found the responsible part in my theme – I have a js-file in which I make various adjustments to the editor and blocks (actually I use
wp.blocks.unregisterBlockType
,wp.blocks.unregisterBlockVariation
,wp.blocks.registerBlockType
,wp.blocks.registerBlockStyle
andwp.hooks.addFilter
). The script is loaded viawp_enqueue_script( 'theme-blocks', get_template_directory_uri() .'/assets/js/blocks.js', array( 'wp-element', 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ) );
whereby thewp-edit-post
part is responsible for the error message.However, when I remove this,
wp.blocks.unregisterBlockType
andwp.blocks.unregisterBlockVariation
no longer work (yes, they are in awp.domReady
call as they should).. In the new theme.json there is also no possibility to specify a list of deactivated blocks.Funnily enough, the console still says:
Block "xxx/xxx" is not registered
, although I can add it again from the inserter after removingwp-edit-post
as dependency.So, how do I deactivate specific blocks for my theme without using
wp-edit-post
?
- The topic ‘“wp.blocks.unregisterBlockType” doesn’t work without “wp-edit-post” in 5.8’ is closed to new replies.