Skip to content
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

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

Open
3 of 6 tasks
sweco-seerjf opened this issue Nov 1, 2024 · 5 comments
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@sweco-seerjf
Copy link

sweco-seerjf commented Nov 1, 2024

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
@sweco-seerjf sweco-seerjf added the [Type] Bug An existing feature does not function as intended label Nov 1, 2024
@virgiliud
Copy link

I am seeing a similar issue with normal non-ACF blocks

@Mamaduka Mamaduka added [Feature] Inserter The main way to insert blocks using the + button in the editing interface Needs Testing Needs further testing to be confirmed. labels Nov 4, 2024
@MGabrane
Copy link

MGabrane commented Nov 7, 2024

I’m experiencing the same issue

Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Dec 16, 2024
@sweco-seerjf
Copy link
Author

This is still an issue with WP Core 6.7.1 and Advanced Custom Fields PRO 6.3.11

@github-actions github-actions bot removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jan 10, 2025
@alexis-magina
Copy link

Hi,
I had the same issue on a website with ACF.
Resolved by adding the 'core/paragraph' to allowed blocks array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants