Skip to content

Block inserter not being displayed when WP filter allowed_block_types_all is used (Core 6.6.2) #66679

Open
@sweco-seerjf

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:

Image

The array coming out from allowed_block_types_all filter after removing default blocks looks something like this:
Image

Digging through the code in block-editor.js I was able to find the condition in the function Items() that might be problematic:

Image

Just returning true here makes the block inserter to display properly again:
Image
Image

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

  1. Create a custom ACF block
  2. Use the filter "allowed_block_types_all" to only return the newly created block
  3. Go to create new page
  4. Add the first block
  5. Now the inserter should have been removed.

Screenshots, screen recording, code snippet

Image

Image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Needs TestingNeeds further testing to be confirmed.[Feature] InserterThe main way to insert blocks using the + button in the editing interface[Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions