Block inserter not being displayed when WP filter allowed_block_types_all is used (Core 6.6.2) #66679
Description
Description
Hi,
We are using ACF to create the blocks on our websites. To remove the default blocks we are also using the filter allowed_block_types_all.
But after upgrading WP Core to 6.6.2 the block inserter below the blocks is no longer displayed after inserting the first block. (Please see the screenshot section)
When I remove the allowed_block hook the inserter is displayed again but a different (default?) version:
The array coming out from allowed_block_types_all filter after removing default blocks looks something like this:
Digging through the code in block-editor.js I was able to find the condition in the function Items() that might be problematic:
Just returning true here makes the block inserter to display properly again:
Returning true on either side of the && in the highligted condition does not seem to work. Both sides need to return true.
Note:
I have tried downgrading ACF but still same issue. Using WP Core 6.5.5 is working as usual.
I hope that this is enough information to backtrack from here. Thanks in advance!
Step-by-step reproduction instructions
- Create a custom ACF block
- Use the filter "allowed_block_types_all" to only return the newly created block
- Go to create new page
- Add the first block
- Now the inserter should have been removed.
Screenshots, screen recording, code snippet
Environment info
Environments:
Wordpress 6.6.2
Plugins:
Advanced Custom Fields PRO 6.3.9
Theme
Custom theme
Browsers:
Edge - Version 130.0.2849.56
Chrome - Version 130.0.6723.71
Firefox - Version 122
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Activity