-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unregisterBlockType not working on domReady and never for core-embed blocks #27607
Comments
@markhowellsmead The embed block subtypes are now registered using block variations. Something like |
Thanks @talldan. Using |
I case anyone else comes across this issue: using E.g. if the Twitter block variation is unregistered, the user can still add a Twitter embed to the site. In order to avoid all embeds, you need to use |
Right—you could probably use a php function to remove support for the oembed provider in addition to the variation if you just wanted to remove one type of embed completely. Maybe this function: |
Ah, there's a good idea! |
The bug also applies to |
Concur with @ptbello: I also use the same |
@markhowellsmead actually I just switched to |
Me too, now ;) I'm guessing that |
Related/very similar issue: #25330 |
actually, everything works on
|
This remains an issue. The suggestion by @kubiqsk works. |
This still isn't working without the non-standard workaround. |
EDIT -> DO NOT USE SUGGESTION BELOW! It breaks stuff. One thing I wish @ryanwelcher that was better documented is that if you want to In other words you need something like this, which is taken from the Block Editor Handbook, but with
|
This issue appears to be resolved in the Block Editor, but still does not work in the Site Editor. cc. @WordPress/outreach. |
My dependencies are defined by the Dependency Extraction Webpack Plugin. It seems unnecessarily complicated to have to break into this logic manually. |
Also I can confirm it is very finicky because of load order, loading speed, cache and whatnot. It works sometimes, and sometimes not. Especially when testing on local it works more often because network is instant, but on live it randomly breaks. For me the very ugly hack of sticking with Unfortunately I also wasn't able to reproduce the core issue in a reliable, testable way. Hence I haven't added a comment here yet although lingering for years. But now that "this is solved" lies in the air I just felt like I had to say something. Although I understand if I'll be ignored since, like I said, I am not (yet) ably to reproduce this in a reliable, testable way. |
Agree with Mark here. The default experience when using the recommended workflows & following regular documentation is not great. And just importing something from |
I'm back-flipping! I agree, this actually isn't solved. Also, disregard my tip above, you should NOT add The actual workaround is to check if you are in the Block Editor or Site Editor as suggested in this comment. I agree with @swissspidy this is still an overly complicated fix. Probably the better option, but still not straightforward is this workaround by @t-hamano. It's also feels like this is a bug when your Block Variations added with the exact same code (dependencies) works in the Site Editor, whereas your Block Styles do not. |
Describe the bug
The documentation indicates that we should use the following code to unregister blocks.
This has no effect. Using the same function on window load works, however. This has been the case for at least the last couple of Core releases, if not more. (Sorry, I have no statistics for older Core versions.)
Additionally, using unregisterBlockType for
core-embed
block types never has any effect.To reproduce
Steps to reproduce the behavior:
Expected behavior
domReady
method should be correct, in line with the documentationEditor version (please complete the following information):
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: